prep_dataset: Prep a dataset by removing variables, remove incomplete...

View source: R/misc.R

prep_datasetR Documentation

Prep a dataset by removing variables, remove incomplete cases, aggregating specified columns, and applying threshold/labeling to the aggregated column

Description

Prep a dataset by removing variables, remove incomplete cases, aggregating specified columns, and applying threshold/labeling to the aggregated column

Usage

prep_dataset(
  x = read_dataset(),
  complete_cases_only = TRUE,
  lump_var = "Calanus finmarchicus",
  lump_fun = dplyr::starts_with,
  drop_var = c("geometry", "longitude", "latitude", "station", "year", "siconc",
    "sithick", complement_species(lump_var)),
  drop_fun = dplyr::starts_with,
  log_var = c("bathymetry", "chlor_a"),
  newname = "patch",
  threshold = 10000
)

Arguments

x

tibble of input data

complete_cases_only

logical, if TRUE drop incomplete records (after deselection)

lump_var

character character, vector of variables to sum into a new column

lump_fun

function, such as starts_with

drop_var

character, the variables to deselect

drop_fun

function, such as starts_with

log_var

character, variables to log scale (base 10), match with any_of

newname

character the name of the new aggregated colum

threshold

numeric, the threshold(s) used to define patches

Value

a tibble cleaned and transformed for downstream processing


BigelowLab/calanusthreshold documentation built on May 12, 2022, 5:06 a.m.