[R] Storing loop output in matrix

Dean Castillo dean.castle at gmail.com
Mon Jan 31 22:49:10 CET 2011


Hello
I am trying to store output from a loop into an empty matrix. The
current code I am using is:
> M<-mat.or.vec(11,89)
> for (j in list(3,91))
+ {M[,(j-2)]<-pic(datain[,j], mytree)}

datain is a matrix (11,91). I only want to use the pic() function on
the columns 3:91.
When I use this code output is stored into the 1st column of M and the
89th column of M but no other columns.

Any help would be greatly appreciated

Dean



More information about the R-help mailing list