For example, I have three data frames a1, a2, a3 in one list c
a1 <- data.frame(x=c(1,2), y=c(2,3))
a2 <- data.frame(x=c(3,4), y=c(4,5))
a3 <- data.frame(x=c(5,6), y=c(6,7))
c <- list(a1, a2, a3)
Now I have a new data frame b1. I want the a1 in c to be replaced by b1.
b1 <- data.frame(x=c(7,8,9), y=c(8,9,10))
I tried to use c[1] <- b1
, which does not work.
c <- list(b1, a2, a3)
will do what I want, but is there a better way to do it?