crest.set_modern_data: Format a 'crestObj' with private data.

View source: R/crest.set_modern_data.R

crest.set_modern_dataR Documentation

Format a crestObj with private data.

Description

Format a crestObj with private data.

Usage

crest.set_modern_data(
  distributions,
  climate,
  df = NA,
  climate_space = NA,
  weight = FALSE,
  minGridCells = 0,
  selectedTaxa = NA,
  site_info = c(NA, NA),
  site_name = NA,
  site_climate = rep(NA, length(climate)),
  verbose = TRUE
)

Arguments

distributions

A dataframe containing the presence records of the studied proxies and their associated climate values.

climate

A vector of the climate variables to extract. See accClimateVariables for the list of accepted values.

df

A data frame containing the data to reconstruct (counts, percentages or presence/absence data).

climate_space

A dataframe of climate values across the study area useful to correct for the imbalance of the sampling data (see 'crest.calibrate for more details). Default is NA.

weight

The records in the distributions can be weighted using the percentages by setting weight=TRUE. Include a column called 'weight' in the distributions table.

minGridCells

The minimum number of unique presence data necessary to estimate a species' climate response. Default is 20.

selectedTaxa

A data frame assigns which taxa should be used for each variable (1 if the taxon should be used, 0 otherwise). The colnames should be the climate variables' names and the rownames the taxa names. Default is 1 for all taxa and all variables.

site_info

A vector containing the coordinates of the study site. Default c(NA, NA).

site_name

The name of the dataset (default NA).

site_climate

The climate values at the location of the dataset '(default NA).

verbose

A boolean to print non-essential comments on the terminal (default TRUE).

Value

A crestObj object containing the spatial distributions.

Examples

#> Reformating the example dataset to fit this function
distributions <- cbind('ProxyName'= rep('Taxon1', nrow(reconstr$modelling$distributions[[1]])),
                       reconstr$modelling$distributions[[1]],
                       stringsAsFactors = FALSE)
for(tax in names(reconstr$modelling$distributions)[-1]) {
  distributions <- rbind(distributions,
                     cbind('ProxyName'= rep(tax, nrow(reconstr$modelling$distributions[[tax]])),
                           reconstr$modelling$distributions[[tax]],
                           stringsAsFactors = FALSE)
                     )
}
distributions <- distributions[, c(2,1,3:6)]
print(head(distributions))

climate_space <- reconstr$modelling$climate_space
print(head(climate_space))

x <- crest.set_modern_data(distributions, df=crest_ex,
                           climate = c("bio1", "bio12"))
x <- crest.set_modern_data(distributions, df=crest_ex,
                           climate_space=climate_space,
                           climate = c("bio1", "bio12"))



crestr documentation built on Jan. 6, 2023, 5:23 p.m.