trim_FR_time: Re-orientate fermentations of a 'BGF' by time

View source: R/move_fermentations.R

trim_FR_timeR Documentation

Re-orientate fermentations of a BGF by time

Description

The function allows to remove data points of individual or all fermentations based on the fermentation/ observation time ('time' column in BiGasData layer of a BGF). The user can either remove data points later than a specified 'time' value, or subtract a specified value from each value in the 'time' column and afterwards optionally remove the resulting times < 0.

Usage

trim_FR_time(x, value, mode = "all", left_end = TRUE, cut_left = TRUE)

Arguments

x

a BGF

value

a numeric; either the time before or after which data points should be removed (or shifted)

mode

a character. Can be 'all' to apply the trimming to all fermentations of a BGF. Otherwise each element in mode must refer to a fermentation label (e.g. 'mode = c("R1","R3","R4","R15")' to trim fermentation R1, R3, R4 and R15)

left_end

logic; default TRUE. Should the fermentation/ observation time be shifted towards the left end? If FALSE data points later than the selected 'value' will be removed

cut_left

logic; default TRUE. Should data points with a negative fermentation/ observation times be removed?

Value

a BGF

Examples

# create example BGF
myBGF <- from_AMPTSV2_report(
        ReactorLayout = c("2*Meso","Cellulose","2*S1 ctrl","2*S1 7d","2*S1 4d",
                          "2*S2 ctrl","2*S2 4d","2*S2 6d"),
        BlankLabel = "Meso",
        name = "myBGF",
        ProcessTemp = 42,
        path = base::system.file("extdata","AMPTSV2.csv",package = "bgfanalyzer"),
        InocToSubRatio = 2,
        feedback = TRUE)

# BioGasData has 735 rows
nrow(myBGF$BioGasData)

# remove all data before day 30
myBGF <- trim_FR_time(myBGF,value= 30)

# BioGasData has now only 285 rows
nrow(myBGF$BioGasData)

# remove all data after day 15
myBGF <- trim_FR_time(myBGF,value= 15,left_end=FALSE,cut_left=FALSE)

# BioGasData has now only 225 rows
nrow(myBGF$BioGasData)


bgfanalyzer documentation built on Sept. 26, 2026, 5:07 p.m.