espace_pca: espace_pca Principal component analysis

View source: R/espace_pca.R

espace_pcaR Documentation

espace_pca Principal component analysis

Description

Principal component analysis to reduce dimensionality of environmental space

Usage

espace_pca(
  sp.name1,
  sp.name2 = NULL,
  occs.z1,
  occs.z2 = NULL,
  bgPts.z1,
  bgPts.z2 = NULL,
  logger = NULL
)

Arguments

sp.name1

character. Name of species 1 to be analyzed.

sp.name2

character. Name of species 2 to be analyzed. Default is NULL.

occs.z1

table of occurrences with environmental values only for sp1.

occs.z2

table of occurrences with environmental values only for sp2. Default is NULL.

bgPts.z1

table of background points with environmental values only for sp1.

bgPts.z2

table of background points with environmental values only for sp2. Default is NULL.

logger

Stores all notification messages to be displayed in the Log Window of Wallace GUI. Insert the logger reactive list here for running in shiny, otherwise leave the default NULL

Details

This function is called by the component espace to calibrate a PCA for 2 species in environmental space. When using within Wallace, GUI parameters are obtained from the model object, in particular, table of occurrences with environmental values and table of background points with environmental values. User must be careful as these tables must contain only environmental variables and not the point coordinates as outputted by model objects. The PCA is calibrated over the whole set of background points. The provided species name(s) are only used for logger messages and not for querying or selecting occurrences.

Value

A list of 14 elements of classes dudi and pca as in dudi.pca

Author(s)

Jamie Kass <jamie.m.kass@gmail.com>

Olivier Broennimann <olivier.broennimann@unil.ch>

See Also

dudi.pca

Examples

## Not run: 
sp.name1 <- "Bassaricyon_alleni"
sp.name2 <- "Bassaricyon_neblina"
envs <- envs_userEnvs(rasPath = list.files(system.file("extdata/wc",
                                           package = "wallace"),
                      pattern = ".tif$", full.names = TRUE),
                      rasName = list.files(system.file("extdata/wc",
                                           package = "wallace"),
                      pattern = ".tif$", full.names = FALSE))

occs.z1 <- read.csv(system.file("extdata/Bassaricyon_alleni.csv",
                    package = "wallace"))
occs.z2 <- read.csv(system.file("extdata/Bassaricyon_neblina.csv",
                    package = "wallace"))

bgPts.z1 <- read.csv(system.file("extdata/Bassaricyon_alleni_bgPoints.csv",
                     package = "wallace"))
bgPts.z2 <- read.csv(system.file("extdata/Bassaricyon_neblina_bgPoints.csv",
                     package = "wallace"))

occsExt.z1 <- raster::extract(envs, occs.z1[, c("longitude", "latitude")])
occsExt.z2 <- raster::extract(envs, occs.z2[, c("longitude", "latitude")])
bgExt.z1 <- raster::extract(envs, bgPts.z1[, c("longitude", "latitude")])
bgExt.z2 <- raster::extract(envs, bgPts.z2[, c("longitude", "latitude")])
pcaZ <- espace_pca(sp.name1, sp.name2,
                   occsExt.z1, occsExt.z2,
                   bgExt.z1, bgExt.z2)

## End(Not run)

wallace documentation built on Sept. 26, 2023, 1:06 a.m.