Amir Liu wrote: > > In l[3] <- matrix(1:4, 2, 2) : > number of items to replace is not a multiple of replacement length >
When inserting single entries into a list list, you should use the '[[ ]]' notation. Use '[ ]' when you want to extract multiple entries or copy multiple entries from one list to another: l <- list() l[[ 1 ]] <- 5 l[[ 2 ]] <- 'cd' l[[ 3 ]] <- matrix( 1:4, 2, 2 ) l [[1]] [1] 5 [[2]] [1] "cd" [[3]] [,1] [,2] [1,] 1 3 [2,] 2 4 Hope this helps! -Charlie -- View this message in context: http://n4.nabble.com/Container-Collection-Object-to-keep-data-structures-and-object-tp932656p932693.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.