View source: R/variable_correlation.R
variable_correlation | R Documentation |
variable_correlation helps in evaluating correlation among distinct variables.
variable_correlation(variables, sample_size = 10000, correlation_limit = 0.8,
save = FALSE, name = "correlation", corrplot = FALSE,
magnify_to = NULL, ...)
variables |
RasterStack, RasterBrick, or matrix. If matrix, columns represent distinct variables for analysis, otherwise, group of raster layers. |
sample_size |
(numeric) sample size to be taken from all variables; default = 10000. |
correlation_limit |
(numeric) absolute value of correlation limit; default = 0.8. |
save |
(logical) whether or not to save the results; default = FALSE. |
name |
(character) name of the csv files to be writen; default = "correlation". |
corrplot |
(logical) whether or not to plot the results; default = FALSE. |
magnify_to |
(numeric) optional value to be used to magnify all values
with absolute correlations above |
... |
other arguments to be passed to |
If magnify_to
is defined and save
= TRUE, an additional csv
file named as "name
_magnified.csv" will be written.
A correlation matrix. If argument corrplot
= TRUE correlation values
are shown in a plot.
# raster layers of environmental data
vars <- raster::stack(list.files(system.file("extdata", package = "ellipsenm"),
pattern = "bio", full.names = TRUE))
# simple correlation matrix
cors <- variable_correlation(variables, sample_size = 5000)
# correlation matrix and plot (values correlated above |0.8| are magnified)
cors <- variable_correlation(variables, sample_size = 5000, corrplot = TRUE,
magnified = 2)
# to save results check arguments "save" and "name"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.