Skip to content

Storing loop output in matrix

3 messages · Dean Castillo, David Winsemius, Peter Ehlers

#
Hello
I am trying to store output from a loop into an empty matrix. The
current code I am using is:
+ {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
#
On Jan 31, 2011, at 4:49 PM, Dean Castillo wrote:

            
R code to create a matix would use the matrix function,
You seem to be coming from a programming paradigm tha t uses "," where  
R would use ":"

list(3,91) is a two element object rather than 3:91 which would be an  
89 element object.

Perhaps you should read some introductory material and get a better  
handle in the R syntax through self study.

http://cran.r-project.org/doc/manuals/R-intro.pdf
What pic function???
 > ?pic
No documentation for 'pic' in specified packages and libraries:
you could try '??pic'
David Winsemius, MD
West Hartford, CT
#
On 2011-01-31 13:49, Dean Castillo wrote:
Have you checked what list(3,91) produces?
Hint: help(seq)

Peter Ehlers