Skip to contents

Get abiotic data from the Vault database. The function will filter out the gridpoints samples in such way, to keep only one gridpoint sample per non-gridpoint sample. First it will filter out gridpoint samples to only keep samples that are within the limit_by_distance_km and limit_by_age_years from non-gridpoint Next, it add sample_id_link column to the non-gridpoint samples, which is the closest gridpoint sample to the non-gridpoint sample. Finally, it will add abiotic data to the gridpoint samples, specified by mode argument. For mode = "nearest", it will add the abiotic data from the closest gridpoint sample. For mode = "mean" and mode = "median", it will first calculate the mean or median abiotic data for each gridpoint sample. The non-gridpoint samples are the samples that are not associated with the

Usage

get_abiotic_data(
  con = NULL,
  mode = c("nearest", "mean", "median"),
  limit_by_distance_km = 50,
  limit_by_age_years = 5000,
  verbose = TRUE
)

Arguments

con

A connection object created by open_vault()

mode

A character string specifying the mode of abiotic data aggregation. It must be one of nearest, mean, or median.

limit_by_distance_km

A numeric value specifying the maximum distance in kilometers between the non-gridpoint and gridpoint samples.

limit_by_age_years

A numeric value specifying the maximum age in years between the non-gridpoint and gridpoint samples.

verbose

A logical value specifying whether to print messages

Value

A connection object with abiotic data