colMapping.Rd
Piping compatible function for modelColumnMapping
used to add column mappings from input data to model object
colMapping(.Object, mappings = NULL, ...)
Model (NlmePmlModel
) object
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 in
mappings
and in ...
. For multiple mapping, i.e. id mapping,
a vector should be provided with the names of columns. See example below.
modified NlmePmlModel
object
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))