soilphys_layered: soilphys_layered

View source: R/soilphys_layered.R

soilphys_layeredR Documentation

soilphys_layered

Description

This function calculates (harmonic-) means of the soilphys dataframe per layer for the flux calculation.

Usage

soilphys_layered(soilphys, layers_map, param, funs, id_cols)

Arguments

soilphys

(dataframe) the soilphys dataframe

layers_map

(dataframe) containing the following parameters:

upper

upper limit of the layer in cm

lower

lower limit of the layer in cm

layer

the name of the layer

...

any id_cols necessary

param

(character vector) A vector containing the names of the variables in soilphys to be carried over

funs

(character vector) A vector defining the type of mean to be used. One of "arith" or "harm"

id_cols

(character vector) A list of all columns, that, together, uniquely identify one profile.

Value

soilphys, reduced to any id_cols and param columns and summarised to the layers provided in layers_map

See Also

Other soilphys: check_soilphys(), complete_soilphys(), discretize_depth()

Examples

data(soildiff)
layers_map <- data.frame(site = rep(c("site_a",
                                      "site_b"),each = 2),
                         upper = c(5,0,7,0),
                         lower = c(0,-100,0,-100),
                         layer = rep(c("HU","M1"),times = 2)
)

soildiff$depth <- (soildiff$upper + soildiff$lower) / 2

soilphys_layered(soilphys = soildiff,
                 layers_map = layers_map,
                 param = c("TPS","a"),
                 funs = c("harm","arith"),
                 id_cols = c("site"))

ConFluxPro documentation built on Aug. 8, 2025, 7:01 p.m.