to calculate a flux such as gross ecosystem production (GPP) or
transpiration (T) as the difference between other fluxes (such as
GPP = NEE - ER). Datetime and other variables to keep will be taken from the
type1 measurement. Fluxes not used here (soilR, LRC or other) are not lost.
a dataframe with $diff = type_a - type_b$ in long format with diff,
type_a, and type_b as flux type, datetime, and any column specified in
cols_keep. Values of datetime and columns in cols_keep for diff row are
taken from type_a measurements.
Arguments
fluxes_df
a dataframe containing fluxes
type_col
column containing type of flux
f_flux
column containing flux values
id_cols
columns used to identify each pair of fluxes
type_a
argument designating type_a fluxes in type column
type_b
argument designating type_b fluxes in type column
diff_name
name to give to the new calculated flux
cols_keep
columns to keep from fluxes_df. Values from type_a row
will be filled in diff row. none (default) keeps only the columns in
id_cols, flux, type and datetime columns; all keeps all the columns;
can also be a vector of column names.