library(ggplot2)
library(reshape2)
ggRGB(rlogo, 1,2,3)
## Run PCA
set.seed(25)
rpc <- rasterPCA(rlogo)
rpc
## Model parameters:
summary(rpc$model)
loadings(rpc$model)
ggRGB(rpc$map,1,2,3, stretch="lin", q=0)
if(require(gridExtra)){
plots <- lapply(1:3, function(x) ggR(rpc$map, x, geom_raster = TRUE))
grid.arrange(plots[[1]],plots[[2]], plots[[3]], ncol=2)
}
Run the code above in your browser using DataLab