## 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 flux rates for methane
# first define CH4 range limit (alternatively use flux.calib)
CH4.lim <- 30
# do the flux rate estimation
flux.CH4 <- flux(gcd.parts, columns=c("CH4ppb", "time_min", "CH4Code",
"cham_vol", "temp_dC", "cham_area"), M = "CH4")
## look at the results table
flux.CH4$flux.table
## plot the concentration-change-with-time-plots as kind of diagnostic
plot(flux.CH4, subs = NULL, dims = c(3,6))
Run the code above in your browser using DataLab