[R] PCA on stacked raster (multiple bands/ layers) in R

Gustavo Bediaga gbediaga at gmail.com
Thu Oct 30 18:14:57 CET 2014


Hi,

You have to transform it to a Data Frame.

Try:

files <- stack(rasterlist)

filesdf<-as.data.frame(files)

pca <- princomp(formula = ~., data = filesdf, cor = TRUE, 
na.action=na.exclude)


hope it helps

Gustavo

Em quinta-feira, 30 de outubro de 2014 14h38min56s UTC-2, John Wasige 
escreveu:
>
> Hello community, I need help on how I can perform PCA on stacked raster
> (multiple bands/ layers) in R. Does any body have an idea or script? 
> Thanks
> John
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-h... at r-project.org <javascript:> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>


More information about the R-help mailing list