View source: R/data_correction.R
| correct_RLayout | R Documentation |
A set of functions that provide shortcuts for frequently used operations conducted on a BGF.
For instance, they allow to specify the reactor layout in a formula like manner or to change a the type of any column of a BGF's metaData or BioGasData layer to numeric.
correct_RLayout(lo)
cols_to_numeric(x, vec = c(2:4), layer = "BioGasData")
lo |
a |
x |
a |
vec |
either a |
layer |
a |
The function correct_RLayout allows to write 'ReactorLayout=c("3*Blank","3*Cellulose","3*Treatment A")' instead of 'ReactorLayout=c("Blank","Blank","Blank","Cellulose","Cellulose","Cellulose","Treatment A","Treatment A","Treatment A")' or 'ReactorLayout=c(rep("Blank",3),rep("Cellulose",3),rep("Treatment A",3))'.
The function will recognize the '\*' and expects an integer on the left side specifying how often the right side should be repeated.
It is useful when dealing with replicates among the fermentations of a BGF, as it can be used to add redundant information to the 'metaData' layer of a (see examples).
The function cols_to_numeric allows to change the type of any column in the metaData or BioGasData layer of a BGF to numeric.
It is possible to apply this change to several columns of the same layer at once.
a character (correct_RLayout)
a BGF (cols_to_numeric)
# define a reactor layout
RL <- c("3*Blank","3*Cellulose","3*Treatment A")
# correct reactor layout
RL_cor <- correct_RLayout(RL)
RL_cor # print corrected layout
# example code
myBGF <- BGF(RL)
# add dry total solutes concentration to 'metaData'
myBGF<-add_metaData(x = myBGF,what = correct_RLayout(c("3*2.9","3*98.7","3*8.4")),lab="TS")
# change the new 'TS' column in 'metaData' layer to numeric
myBGF <- cols_to_numeric(myBGF,"TS","metaData")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.