chop: Prepare data for flux rate estimation with 'flux' or GPP/Reco...

View source: R/chop.R

chopR Documentation

Prepare data for flux rate estimation with flux or GPP/Reco modelling.

Description

The function simply constructs a list of data.frames that each contains the data for one closed chamber measurement or for one NEE/GPP or R_eco model.

Usage

chop(dat, factors, nmes = NULL, min.cm = 3)

Arguments

dat

data.frame containing static closed chamber data for several chamber measurements. See columns and example for details.

factors

A character vector giving the names of the columns that are used to partition the data in dat into chunks that each contains the data for one chamber placement. factors \subset columns! See example.

nmes

A character vector giving the names of the columns that are used to name the data chunks. nmes \subset columns! See example.

min.cm

Integer giving the minimum number of concentration measurements allowed per chamber measurement. Defaults to 3 because a linear fit to 2 points does not make any sense. Attention: Chamber placements with less than min.cm measurements are quietly skipped.

Details

This could easily be hand scripted (e.g. with split) but the function shall provide a simple way to obtain the structure needed for flux and it also carries naming information.

Value

Returns a list with 2 entries. The first is itself a list of data.frames containing the concentration measurements that result from the field sampling during one chamber placement (if factors was specified correctly) and the columns specified in columns. The entries in the list are named according to nmes. However, the second part of the upper level list is a table with the naming information. This is handed over to flux and plot.fluss. See example.

Author(s)

Gerald Jurasinski <gerald.jurasinski@uni-rostock.de>

See Also

flux

Examples

## load example data
data(tt.pre)

## extract field concentration measurements
gcd <- tt.pre[tt.pre$sampletype_a=="P",]

## partition the data into data tables per chamber measurement
gcd.parts <- chop(gcd, factors = c("date", "spot", "veg"), 
nmes = c("date", "veg", "spot"))
# have a look at the first three tables
gcd.parts$tables[1:3]
# have a look at the names part of the returned object
gcd.parts$nmes
# use inspect to have a look at (a) specific data table(s)
inspect(gcd.parts, c("2011-03-15.c.3", "2011-03-15.c.6", "2011-03-15.p.6"))
# inspect the same tables using their indices
inspect(gcd.parts, c(3,6,12))
inspect(gcd.parts, c("c.3", "c.6", "p.6"))

flux documentation built on June 26, 2022, 9:05 a.m.