SelCue: Select the time cues

Description Usage Arguments Value Examples

View source: R/Select_time_cues.R

Description

This is a function to manually select and extract the start or the end time of each measurement as time cues by clicking the corresponding start or end measurement points on the interactive graphs generated by the function. The data frame returned from this function can be assigned to the argument df_cue in the FluxCal function. Note that the time cue data frame can also be prepared by the user independent of this function following the format of "_1.csv" and "_2.csv" at https://github.com/junbinzhao/FluxCalR/tree/master/inst/extdata).

Usage

1
2
3
4
5
6
7
8
SelCue(
  data,
  flux = "CO2",
  cue = "End",
  spt = 1,
  ylim = NULL,
  save = "Time_cue.csv"
)

Arguments

data

A dataframe generated by the function LoadLGR or LoadOther.

flux

A string, either "CO2" (default) or "CH4", indicates that either CO2 or CH4 concentration should be plotted for selecting the time cues.

cue

A string, either "End" (default) or "Start", indicates whether the end or the start time of each measurement is to be selected. "End" is recommended is here, since the end of each measurement is more identifiable, which usually coincides with a sudden drop/rise in the gas concentrations due to the removal of chamber at the end of the measurement.

spt

An integer indicates the number of sections to split the CO2/CH4 time series into when plotting (default: 1). Cutting CO2/CH4 time series into several sections will aid the visualization and selection of the time cues when the dataset is too long.

ylim

A numeric vector of length 2, giving the y-axis scale range for CO2/CH4 concentrations (ppm). If not specified (default), it will be set based on the CO2/CH4 range of the entire dataset.

save

A string includes output directory and file name (.csv) to export the extracted time cue data frame. Default: a file named "Time_cue.csv" with the extracted time cues will be created under the current work directory. The file created can be loaded and re-used in the flux calculation to get reproducible results. FALSE, do not export the file.

Value

A data frame that includes two columns: "Num", the number of each measurement; "Start" or "End", the time selected as the start or end of each measurement (HH:MM:SS)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
library(FluxCalR)
#### data from LGR
# get the directory of the example LGR raw data
example_data1 <- system.file("extdata", "Flux_example_1_LGR.txt", package = "FluxCalR")
# load the data
Flux_lgr <- LoadLGR(example_data1)
# select cues
Cues <- SelCue(Flux_lgr, save = FALSE)
Cues

## End(Not run)

junbinzhao/R-Package-FluxCalR documentation built on May 25, 2021, 5:49 a.m.