35
Basic question: In R, how can I make a list and later populate it with vector elements?
l <- list()
l[1] <- c(1,2,3)
This gives the error "number of items to replace is not a multiple of replacement length", so R is trying to unpack the vector. The only way I have found to work so far is to add the vectors when making the list.
l <- list(c(1,2,3), c(4,5,6))