Skip to content
Prev 313500 / 398502 Next

using 'apply' to apply princomp to an array of datasets

Hello,

As for the first question try

scoreset <- lapply(pcl, function(x) x$scores[, 1])
do.call(cbind, scoreset)


As for the second question, you want to know which columns in 'datasets' 
have NA's?

colidx <- apply(datasets, 2, function(x) any(is.na(x)))
datasets[, colidx]  # These have NA's


For the column numbers you can do

colnums <- which(colidx)

Hope this helps,

Rui Barradas

Em 12-12-2012 17:14, David Romano escreveu: