On 05/04/2010 3:20 PM, Trafim Vanishek wrote:
Dear all,
My question how is it possible to define a matrix A with 10 rows 1 column,
so that its elements are vectors of undefined length.
I need to have a possibility later to add elements like A[1,1] <-
c(A[1,1],3,4,5)
Thanks a lot for the help!
You create the matrix from a list:
A <- matrix( as.list(1:10), 10, 1)
But now you need to be careful: This won't work
A[1,1] <- c(A[1,1],3,4,5)
you need
A[[1,1]] <- c(A[[1,1]],3,4,5)
Duncan Murdoch
______________________________________________
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.