# NOT RUN {
old <- list(a=1,b="red",c=1.37)
new <- list(b="green",c=2.4)
update(old, new)
update.list(old,new) # equivalent
older <- list(a=0, b="orange", 4, 5, 6)
newer <- list(b="purple", 7, 8, 9)
update(older, newer) # ignores unnamed elements of newer
update(older, newer, unnamed=TRUE) # appends unnamed elements of newer
# }
# NOT RUN {
<!-- %%data(iris) -->
# }
# NOT RUN {
<!-- %%iris$Species <- as.character(iris$Species) -->
# }
# NOT RUN {
<!-- %%df.old <- cbind(iris[1:5,], letters=1:5) -->
# }
# NOT RUN {
<!-- %%df.new <- df.old[3:5,] -->
# }
# NOT RUN {
<!-- %%df.new$Petal.Width <- df.new$Petal.Width + 0.1 -->
# }
# NOT RUN {
<!-- %% -->
# }
# NOT RUN {
<!-- %%df.old -->
# }
# NOT RUN {
<!-- %%df.new -->
# }
# NOT RUN {
<!-- %%update(df.old, df.new, by=c(letters)) -->
# }
Run the code above in your browser using DataLab