Add column mappings
colMapping.Rd
Piping compatible function for modelColumnMapping
used to add column mappings from input data to model object
Arguments
- .Object
Model (
NlmePmlModel
) object- mappings
Named character vector specifying valid column names in the input data. Character vector names must be valid model variable names contained in
modelVariableNames(model)
.- ...
optional pairs ModelTerm = ColumnName or ModelTerm = "ColumnName". Has higher precedence than
mappings
if some ModelTerm is mapped twice inmappings
and in...
. For multiple mapping, i.e. id mapping, a vector should be provided with the names of columns. See example below.
Examples
pkData$id2 <- pkData$Subject
model <- pkmodel(columnMap = FALSE,
data = pkData)
modelvar <- unlist(modelVariableNames(model))
colnames <- c("Subject", "Act_Time", "Amount", "Conc")
names(colnames) <- modelvar
# will map subject directly
colnames <- colnames[-c(1)]
model <- colMapping(model, colnames, id = c(Subject, id2))
# also possible:
model <- colMapping(model, colnames, id = c("Subject", "id2"))
# not recommended since only not quoted names are identified
# if both types are provided:
model <- colMapping(model, colnames, id = c("Subject", id2))