Displaying 1 result from an estimated 1 matches for "score1set1".
2012 Dec 12
2
using 'apply' to apply princomp to an array of datasets
...each dataset, and create a matrix of the
first principal component scores.
In this example, 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(cbin...