bin_tables {nichevol} | R Documentation |
Bin tables of environmental conditions in M and for occurrences from objects
Description
bin_tables helps in creating bin tables of environmental conditions in accessible areas (M) and species occurrence records (i.e., table of characters). This is done using results from previous analyses, and can be applied to various species and multiple variables.
Usage
bin_tables(ranges, percentage_out = 5, n_bins = 20, bin_size, save = FALSE,
output_directory, overwrite = FALSE, verbose = TRUE)
Arguments
ranges |
list of ranges of environmental values in M and in species
occurrences derived from using the function |
percentage_out |
(numeric) percentage of extreme environmental data in M to be excluded in bin creation for further analyses. See details. Default = 5. |
n_bins |
(numeric) number of bins to be created from the range of environmental values considered when creating each character in bin tables. Default = 20. See details. |
bin_size |
(numeric) argument deprecated, use n_bins instead. |
save |
(logical) whether or not to save the results in working directory. Default = FALSE. |
output_directory |
(character) name of the folder in which results will be written. |
overwrite |
(logical) whether or not to overwrite existing results
in |
verbose |
(logical) whether messages should be printed. Default = TRUE. |
Details
The percentage to be defined in percentage_out
must correspond with
one of the confidence limits defined in histograms_env
(argument CL_lines
). For instance, if CL_lines
= 95, then
percentage_out
can only be either 5 (keeping data inside the 95 CL) or
0 (to avoid exclusion of extreme values in M).
Excluding a certain percentage of extreme environmental values prevents the algorithm from considering extremely rare environmental values in the accessible area for the species (M). Being too rare, these values may have never been explored by the species; therefore, including them in the process of preparation of the table of characters (bin table) is risky.
The argument n_bins
helps to define how many characters (bins) will be
considered for the range of values in each variable. This is, a value of 20
determines that a range of temperature (5-25) will be split approximately
every 1 degree. The argument bin_size
has been deprecated.
Value
A list named as in ranges
containing the table(s) of characters.
A folder named as in output_directory
containing all resulting csv
files with the tables of characters will be created if save
is set as
TRUE.
Potential values for characters are:
"1" = the species is present in those environmental conditions.
"0" = the species is not present in those environmental conditions. This is, those environmental conditions inside the accessible area (M) are more extreme than the ones used for the species.
"?" = there is no certainty about the species presence in those environmental conditions. This happens if environmental combinations are more extreme than the ones found in the accessible area (M), when environmental conditions in species records are as extreme as the most extreme ones in M.
Examples
# simple list of ranges
ranges <- list(temp = data.frame(Species = c("sp1", "sp2", "sp3"),
Species_lower = c(120, 56, 59.75),
Species_upper = c(265, 333, 333),
M_lower = c(93, 39, 56),
M_upper = c(302, 333, 333),
M_95_lowerCL = c(158, 91, 143),
M_95_upperCL = c(292, 290, 326)),
prec = data.frame(Species = c("sp1", "sp2", "sp3"),
Species_lower = c(597, 3, 3),
Species_upper = c(3492, 2673, 6171),
M_lower = c(228, 3, 3),
M_upper = c(6369, 7290, 6606),
M_95_lowerCL = c(228, 3, 3),
M_95_upperCL = c(3114, 2376, 2568)))
# bin preparation
bins <- bin_tables(ranges, percentage_out = 5, n_bins = 20)
# see arguments save and output_directory to write results in local directory