View source: R/support_data_import.R
| add_bmp_measurement | R Documentation |
A set of internal functions that bridge the data import and object creation when using from_AMPTSV2_report or from_standard_record to create an BGF.
These functions are not meant for direct user interaction.
add_bmp_measurement(x, path, mode = "auto", feedback = FALSE)
add_standard_record(
x,
path,
header = TRUE,
dec = ".",
sep = "\t",
units = "hours",
time_col = "time",
RName = "R1",
product_col = "GCounter..ml.",
feedback = TRUE
)
add_ExpPara(x, rawReport, feedback = FALSE)
add_ExpSetup(x, rawReport, feedback = FALSE)
sort_AMPTSV2_reactors(x, rawReport, feedback = FALSE)
sort_standardReport(x, rawReport, RName, product_col)
x |
a |
path |
a |
mode |
the mode |
feedback |
|
header |
|
dec |
a single |
sep |
a single |
units |
the desired unit of the time difference calculated by |
time_col |
a |
RName |
a |
product_col |
a |
rawReport |
either a |
The function add_bmp_mesurement is called by from_AMPTSV2_report.
It imports a .csv-file created by the AMPTS II (BioProcess Control; Lund; Sweden) from a location on the system specified in path and adds it to a BGF specified in x.
Internally, add_bmp_mesurement calls read_raw_AMPTSV2_report to import the external file to a list and then it calls add_ExpPara, add_ExpSetup and sort_AMPTSV2_reactors to transfer the data to the BGF.
The function add_standard_record is similar to add_bmp_measurement, put in this case path must point to an external text file with a matrix like data structure.
This matrix must have at least two columns, one with information on when the measurement was recorded (time_col), the other with a cumulative biogas volume measurement (product_col).
Additional columns can be present and will be imported as well.
Internally, add_standard_record calls import_standard_record to import the data and next it calls calc_FR_time to calculate a standardized fermentation time for the imported data set.
Finally, it calls sort_standardReport to transfer the imported data to the BGF
The function will not remove empty rows resulting from object creation within the BGF.
Thus, it is advised to use update_BGF to ensure the integrity of the BGF.
The function add_ExpPara is called by add_bmp_measurement and acts as a wrapper for add_ExpParam to transfer experimental meta data to a BGF object.
It expects a list created by read_raw_AMPTSV2_report as a second argument.
Similarly,the function add_ExpSetup is also called by add_bmp_measurement, but acts as a wrapper for add_metaData to transfer fermentation meta data to a BGF object.
Consequently it also expects a list created by read_raw_AMPTSV2_report as a second argument.
In addition, sort_AMPTSV2_reactors is also called by add_bmp_measurement and acts as a wrapper for add_BG_measurement and alter_BG_measurement to transfer cumulative biogas volume and biogas flow data to a BGF.
Like the former two functions, it expects a list generated via read_raw_AMPTSV2_report as second argument
Additional details...
a BGF
# create an example BGF
myBGF <- BGF(ReactorLayout = c("2*Blank","Cellulose","3*neg ctrl","3*FR1","3*FR2","3*FR3"),
name = "myBGF",
ProcessTemp = 52,
MeasurementType = "AMPTSV2")
myBGF # print the BGF
# add data from external files
myBGF <- add_bmp_measurement(
x = myBGF,
path = base::system.file("extdata","AMPTSV2.csv",package = "bgfanalyzer"))
myBGF # print the BGF
# create another example BGF
myBGF2 <- BGF("A")
myBGF2 # print the BGF
# add data from an external file (standard record)
myBGF2 <- add_standard_record(
x = myBGF2,
path = base::system.file("extdata","Fermentation_B.tsv",package = "bgfanalyzer"),
RName = "R1",
time_col = "UTC",
product_col = "GCounter..ml.")
myBGF2 # print the BGF
# create an additional example BGF
myBGF3 <- BGF(c("2*Blank","Cellulose","3*neg ctrl","3*FR1","3*FR2","3*FR3"))
myBGF3 # print the BGF
# import standard record
rawReport <- read_raw_AMPTSV2_report(
path = base::system.file("extdata","AMPTSV2.csv",package = "bgfanalyzer"))
# add experimental meta data to BGF
myBGF3 <- add_ExpPara(myBGF3,rawReport,TRUE)
myBGF3 # print the BGF
# add fermentation meta data to BGF
myBGF3 <- add_ExpSetup(myBGF3,rawReport,TRUE)
myBGF3 # print the BGF
# add biogas volume and flow data
myBGF3 <- sort_AMPTSV2_reactors(myBGF3,rawReport)
myBGF3 # print the BGF
# create an empty example BGF
myBGF4 <- BGF("myBGF4")
myBGF4 # print the BGF
# import a standard record
rawReport2 <- import_standard_record(
ipath = base::system.file("extdata","Fermentation_B.tsv",package = "bgfanalyzer"))
# calculate a fermentaion/ observation time
rawReport2<-calc_FR_time(rawReport2,1,units="hours")
# add imported data to BGF
myBGF4 <- sort_standardReport(myBGF4,rawReport2,"R1",3)
myBGF4 # print BGF
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.