It might sound stupid but:
I have a list for every country BE, AT, DE, etc. that I have performed pca, in a loop:
countries <- c("BE","BG","CZ","DK","DE","EE","IE","EL","ES","FR",
"HR","IT","CY","LV","LT","HU","MT","NL","AT","PL","PT",
"RO","SI","SK","FI","SE","UK")
for (x in countries){
pca_list[[x]] <_ prcomp(pcaData_list[[x]], scale=TRUE)
}
Next I want a nice biplot, so I am using a ggbiplot from github("vqv/ggbiplot"), so I put the ggbiplot in the loop and I have the following:
for (x in countries){
pca_list[[x]] <- prcomp(pcaData_list[[x]],scale=TRUE)
ggbiplot(pca_list$x,scale=1,varname.size =0,varname.abbrev=1)
}
However, it doesn't work. I have tried replacing the pca_list$x
with paste0("pca_list$",x)
in the ggbiplot command but it still doesn't work.
Both tries give me an error:
Expected a object of class prcomp, princomp, PCA, or lda
Further, when I do the same for one country in specific, say AT I do get a result.
ggbiplot(pca_list$AT,scale=1,varname.size =0,varname.abbrev=1)