validate_BGF: Validation of data integrity

View source: R/validation.R

validate_BGFR Documentation

Validation of data integrity

Description

A set of two functions, that allow to validate and re-establish data integrity of a BGF.

Usage

validate_BGF(x)

update_BGF(x, delete_missing_BGD = FALSE)

Arguments

x

a BGF

delete_missing_BGD

logic; defaults to FALSE. If TRUE fermentations/ rows in the metaData-layer with no data in the BioGasData-layer will be removed from the metaData-layer.

Details

The function validate_BGF can be used to check whether an object is a BGF or not. It will raise an error if an object does not fulfill the criteria of a BGF.

The function update_BGF checks and updates several parameters, so that the internal logic of a BGF is consistent. First of all, it checks if all all fermentations in the metaData-layer occur in the BioGasData-layer of a BGF and vice versa. It than adds a row to the metaData-layer, if it detects any fermentation in the BioGasData-layer, that is not yet represented in the metaDatalayer.

In the opposite case, a fermentation has an entry in the metaData but not in the BioGasData-layer, the user can decide whether this fermentation should be removed from the metaData-layer or not.

The function will also remove rows that have NAin the 'reactor' column from the BioGasData-layer, sort observations in that layer by 'reactor' and 'time' columns and finally generates new valid row names representing the new row number of an observation in the reordered BioGasData-layer.

Value

a BGF

Examples

# create an example BGF
myBGF <- new_BGF("myBGF",52,2,LETTERS[1:15],"A","manuel")

# check if 'myBGF' fulfills the criteria of being a BGF
validate_BGF(myBGF)

# print myBGF
myBGF

# updating the BGF will remove observations from `BioGasData`-layer
myBGF <- update_BGF(myBGF)

# print myBGF again
myBGF


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