View source: R/subsetting_BGF.R
| subset_BGF | R Documentation |
BGF'sFunctions that allow sub-setting and merging of ‘BGF“’s.
subset_BGF(x, reactor = NULL, layout = NULL, name = NULL)
merge_BGF(x, y, mergeParam = FALSE, x_tag = NULL, y_tag = NULL, name = NULL)
x, y |
a |
reactor |
defaults to |
layout |
defaults to |
name |
defaults to |
mergeParam |
|
x_tag, y_tag |
defaults to |
The function subset_BGF can be used to subset a BGF.
The user can either use reactor/ fermentation names (= row names of metaData-layer, values in column 'reactor' of BioGasData-layer), or reactor layouts (= values in 'Layout' column of metaData-layer) as a basis for subsetting.
Furthermore, it is possible to give a new name to the resulting subset.
The function merge_BGF can be used to merge two BGF's.
On the way, it will generate new row names for the metaData-layer and adjust the values in the 'reactor' column of the BioGasData-layer appropriately.
In general, it is advised to only merge BGF's that have the same values in their ExpParam-layer, as with the default setting only the ExpParam-layer of the first BGF passed to merge_BGF is preserved.
It is possible to change the default behavior with the 'mergeParam' argument.
In that case, new names for entries in the merged ExpParam-layer will be generated if a entry is either present in only one ÈxpPram-layer of the BGF's or if the values for the same entry in both BGF's differs.
The new names are prolonged by a specific tag (controlled via arguments 'x_tag' and 'y_tag'), so that it is clear where that entry originates from.
Furthermore, these tags will be added to the metaData- and BioGasData-layer.
a BGF
# create an example BGF
myBGF <- from_AMPTSV2_report(
ReactorLayout = c("2*Blank","Cellulose","2*S1 ctrl","2*S1 7d","2*S1 4d",
"2*S2 ctrl","2*S2 4d","2*S2 6d"),
BlankLabel = "Blank",
name = "myBGF",
InocToSubRatio=2,
ProcessTemp = 52,
path = base::system.file("extdata","AMPTSV2.csv",package = "bgfanalyzer"))
myBGF
# subset using 'reactor' argument
myBGF_subset1 <- subset_BGF(myBGF,reactor=c(4:9),name="subset 1")
myBGF_subset1
# subset using 'layout' argument
myBGF_subset2 <- subset_BGF(myBGF,layout=c("S2 ctrl","S2 4d","S2 6d"),name="subset 2")
myBGF_subset2
# merge the BGF's
mergedBGF <- merge_BGF(myBGF_subset1,myBGF_subset2,TRUE)
mergedBGF
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.