R/ChromBackend-functions.R
fillCoreChromVariables.Rd
fillCoreChromVariables()
fills a provided data.frame
(or DataFrame
)
with columns for eventually missing core chromatogram variables except
peaks variables (i.e. "intensity"
and "rtime"
). The missing core
variables are added as new columns with missing values (NA
) of the
correct data type.
Use coreChromVariables()
to list the set of core variables and their data
types.
fillCoreChromVariables(x = data.frame())
data.frame
with potentially present core chrom variable columns
input data frame x
with missing core variables added (with the
correct data type).
## Define a data frame
a <- data.frame(msLevel = c(1L, 1L, 2L), other_column = "b")
## Add missing core chromatogram variables to this data frame
fillCoreChromVariables(a)
#> msLevel other_column chromIndex collisionEnergy dataOrigin dataStorage
#> 1 1 b NA NA <NA> <NA>
#> 2 1 b NA NA <NA> <NA>
#> 3 2 b NA NA <NA> <NA>
#> msLevel mz mzMin mzMax precursorMz precursorMzMin precursorMzMax productMz
#> 1 NA NA NA NA NA NA NA NA
#> 2 NA NA NA NA NA NA NA NA
#> 3 NA NA NA NA NA NA NA NA
#> productMzMin productMzMax
#> 1 NA NA
#> 2 NA NA
#> 3 NA NA
## The data.frame thus contains columns for all core chromatogram
## variables in the respective expected data type (but filled with
## missing values).