Skip to contents

This function performs a principal components analysis on environmental variables across the geographic extent of a popmaps() inference. The function crops environmental layers to the extent of the raster layer used in other popmaps analyses (i.e., input_raster).

Usage

popmap_pca(input_raster = "", bio_dir = "")

Arguments

input_raster

An R RasterLayer object defining the geographic extent for the spatial interpolation.

bio_dir

A string defining the pathway to a folder containing the environmental variables that will be used in a PCA. Environmental layers must be able to be loaded by raster::raster(). For example, the 19 biolclimatically informative variable available form WorldClim (https://www.worldclim.org/) work well. Layers must be the same size or larger than input_raster - if larger, popmap_pca() will crop layers to the dimensions of input_raster.

References

Massatti R & Winkler DE. (2022) Spatially explicit management of genetic diversity using ancestry probability surfaces. Methods in Ecology and Evolution. http://dx.doi.org/10.1111/2041-210X.13902

Author

Rob Massatti

Examples

if (FALSE) { # \dontrun{
    #This function requires a pathway to a folder containing environmental data layers that are not included in the POPMAPS package.
    pca <- popmap_pca(input_raster=hija_raster, bio_dir='./wc2.1_30s_bio/')
    plot(pca$Comp.1, ext = hija_raster@extent) 
    points(hija_struc[,2:3],pch=19, col='black')
} # }