Learn R Programming

Certara.RsNLME (version 3.1.0.1)

colMapping: Add column mappings

Description

Piping compatible function for modelColumnMapping used to add column mappings from input data to model object

Usage

colMapping(.Object, mappings = NULL, ...)

Value

modified NlmePmlModel 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 in mappings and in .... For multiple mapping, i.e. id mapping, a vector should be provided with the names of columns. See example below.

See Also

dataMapping modelVariableNames

Examples

Run this code
pkData$id2 <- pkData$Subject
model <- pkmodel(columnMap = FALSE,
                 data = pkData,
                 workingDir = tempdir())

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))

Run the code above in your browser using DataLab