Dataset containing sampling depth (upper+lower) and numeric values can be aggregated to equal depth increments. Depths and res_out should be stated in meters. [Experimental]

cm_aggregate(
  dataset,
  depth_top_col,
  depth_bottom_col,
  aggregate_list,
  group_list = "o3",
  res_out = 0.1,
  add_funs = NULL
)

Arguments

dataset

An R tibble or data.frame

depth_top_col

Upper sampling depth column name

depth_bottom_col

Lower sampling depth column name

aggregate_list

Columns to be aggregated. Can be character vector or string. Selected column must be numeric

group_list

Optional grouping variables (e.g., sites, sampling points, soil cores etc.). Default set to o3 corresponding to output upper depth (no additional grouping).

res_out

Aggregate depth increments that are to be returned. Should be same unit as depth_bottom_col and depth_top_col.

add_funs

List of additional function arguments like sd or n that can be passed to summarise. This will change output for aggregate vars to ..._mean, ..._sd, etc.