pca: Calculate PCA

Description Usage Arguments Details Value References Examples

Description

Calculate principal components from raster data values. The raster can either be supplied as Raster* object, satellite* object or as a list of Raster* objects. The latter is usefull if the raster dataset has been tiled into small observation areas using e.g. snipRaster.

Usage

1
2
3
4
5
6
7
8
9
## S4 method for signature 'Satellite'
pca(x, bcde, prfx = NULL, return_raster = FALSE, ...)

## S4 method for signature 'RasterStack'
pca(x, return_raster = FALSE, ...)

## S4 method for signature 'list'
pca(x, ignore_names = FALSE, center = TRUE, scale = TRUE,
  ...)

Arguments

x

Satellite, Raster* or list of Raster* objects

bcde

Band code(s) to be used for computing the pca

...

Further arguments passed on to RStoolbox::rasterPCA or stats::prcomp

ignore_names

If list is supplied and if the band names of the individual rasters do not match (e.g. because of different observation dates), ignore the names when building a single data frame for the PCA computation (does not hurt).

center

See stats::prcomp

scale

See stats::prcomp

Details

The method for Raster* and Satellite* objects is basically a wrapper arround the respective function in the RStoolbox package. For the list (i.e. snip) related implementation, the stats::prcomp function is used to actually compute the PCA.

Value

If x is a Satellite object, a Satellite object with added image textures; if x is a raster::Raster* object, a raster::Raster* object with converted layer(s).

References

Benjamin Leutner and Ned Horning (2016). RStoolbox: Tools for Remote Sensing Data Analysis. R package version 0.1.6. https://CRAN.R-project.org/package=RStoolbox

Examples

1
2
3
4
5
6
7
8
## Not run: 
path <- system.file("extdata", package = "satellite")
files <- list.files(path, pattern = glob2rx("LC8*.TIF"), full.names = TRUE)
sat <- satellite(files)

sat <- pca(sat, bcde = "B004n")

## End(Not run)

environmentalinformatics-marburg/satelliteTools documentation built on May 16, 2019, 8:16 a.m.