#----
# Examples for update.list()
#----
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
#----
# Examples for update.data.frame
#----
old <- data.frame(letter=letters[1:5], number=1:5)
new <- data.frame(letter=letters[c(5, 1, 7)], number=c(-5, -1, -7))
update(old, new, by="letter") # default is append=TRUE
update(old, new, by="letter", append=FALSE)
update(old, new, by="letter", verbose=FALSE)
Run the code above in your browser using DataLab