Displaying 1 result from an estimated 1 matches for "score1matrix".
2012 Dec 12
2
using 'apply' to apply princomp to an array of datasets
...le, I could do:
> pcl<-apply(datasets,2,princomp)
which yields a list of princomp output, one for each dataset, so that the
vector of first principal component scores for dataset 1 is obtained by
> score1set1 <- pcl[[1]]$scores[,1]
and I could then obtain the desired matrix by
> score1matrix <- cbind( score1set1, score1set2, score1set3)
So my first question is: 1) how could I use *apply to do this?  I'm having
trouble because pcl is a list of lists, so I can't use, say, do.call(cbind,
...) without first having a list of the first component score vectors,
which I'm not...