ssc: Select Observations

View source: R/gen_general.r

sscR Documentation

Select Observations

Description

Create includes or excludes from the dataset by selecting from any variable in any logical combination, using the available logical operators like e.g. '|' and '&'.

Usage

ssc(dataset, criteria, include = TRUE, keepEC = FALSE)

Arguments

dataset

An object of class 'aquap_data'

criteria

The selection criteria in the format variableName == value, possibly joined by logical operators.

include

Logical. If the observations matching the criteria should be included or excluded from the dataset.

keepEC

If *all* the environmental control observations should be kept in the dataset. Only evaluated if 'include' is TRUE.

Details

The column names are provided as is, i.e. without quotes, while for characters the values have to be enclosed in quotation marks - see examples.

Value

The standard dataset as described in getFullData

See Also

Other Data pre-treatment functions: [,aquap_data-method, do_addNoise(), do_avg(), do_blowup(), do_detrend(), do_emsc(), do_gapDer(), do_msc(), do_resampleNIR(), do_sgolay(), dpt_modules, selectWls()

Examples

 ## Not run: 
 ds <- ssc(dataset, C_Group=="Control")
 # keeps all the controls
 ds <- ssc(dataset, C_Group!="Control", include=FALSE)
 # the same as above
 
 
 ds <- ssc(dataset, C_Group=="Control" & C_Repl=="R1")
 # keeps only the first replicate of the controls
 ds <- ssc(dataset, C_Group=="Control" | C_Repl=="R1")
 # keeps all the first replicate and all the controls
 
 
 ds <- ssc(dataset, C_Group=="Control" & C_Repl=="R1", keepEC=TRUE)
 # keeps the first replicate of the controls and all the environmental controls
 ds <- ssc(dataset, C_Group=="Control" & C_Repl=="R1", include=FALSE)
 # keeps everything except the first replicate of the controls
 
 
 ds <- ssc(dataset, (C_Group=="Control" | C_Group=="Treatment") & Y_conSNr==1)
 # keeps the first consec. scan of the controls and the treatment group.
 ds <- ssc(dataset, (C_Group=="Control" | C_Group=="MQ") & C_conSNr=="1")
 # keeps the first consec. scan of the controls and the environmental controls
 
 
 ds <- ssc(dataset, Y_Temp==22.5)
 ds <- ssc(dataset, Y_Temp==22.5 & Y_conSNr==1)
 ds <- ssc(dataset, Y_conSNr==1) 
 # keeps only the first consecutive scan
 
## End(Not run)

bpollner/aquap2 documentation built on March 29, 2024, 7:33 a.m.