## 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
# first tell which columns of the data you want to carry on
columns <- c("date", "veg", "spot", "time_min", "temp_dC", "cham_area",
"cham_vol", "CO2ppm", "CO2Code", "CH4ppb", "CH4Code", "N2Oppb", "N2OCode")
# then do the partitioning
gcd.parts <- conz.prep(gcd, columns, factors = c("date", "spot", "veg"),
nmes = c("date", "veg", "spot"))
## calculate range limits according to the data and the accompanying
## calibration gas measurements
# extract and prepare calibration measurements
cal <- tt.pre[tt.pre$sampletype_a=="E",c("date_gc", "CH4ppb", "CH4Code",
"CO2ppm", "CO2Code", "N2Oppb", "N2OCode")]
names(cal)[1] <- "date"
cal$date <- "2011-03-16"
# calculate the range limits per gas (makes no real sense with such
# a small dataset.
# CH4 range limits
CH4.lims <- flux.calib(gcd.parts, columns = c("date", "CH4ppb"),
calib = cal, format="%Y-%m-%d")
# N2O range limits
N2O.lims <- flux.calib(gcd.parts, columns = c("date", "N2Oppb"),
calib = cal, format="%Y-%m-%d")
# CO2 range limits
CO2.lims <- flux.calib(gcd.parts, columns = c("date", "CO2ppm"),
calib = cal, format="%Y-%m-%d")
Run the code above in your browser using DataLab