Create a new observed data set
create_observed_data.RdCreate an ospsuite::DataSet from named arguments. This is a thin
factory around loadDataSetFromSnapshot() that builds the raw
snapshot observed-data shape for you and converts it into a
DataSet.
An observed data entry is the time + value (+ optional error) series attached to a snapshot. It is referenced by name from a Snapshot's simulations.
Usage
create_observed_data(
name,
time,
values,
error = NULL,
molecular_weight = NULL,
lloq = NULL,
metadata = NULL
)Arguments
- name
Character. Name of the observed data set (required).
- time
A
time()object giving the time grid x-values and their unit (required).- values
A
values()object giving the measurement y-values, their dimension, and an optional unit (required), same length astime. The dimension is supplied tovalues()and is required there.- error
A
error()object giving the optional error y-values, an optional unit (defaulting to the values unit), and the auxiliary type. Same length as the values series.NULLfor no error series.- molecular_weight
Numeric. Molecular weight to attach to the data set, in g/mol.
- lloq
Numeric. Lower limit of quantification.
- metadata
Named list. Extended properties (key/value pairs) stored alongside the data set.
Value
An ospsuite::DataSet object.
Examples
# Create a minimal observed data set
obs <- create_observed_data(
name = "Subject 001",
time = time(c(0, 1, 2, 4, 8)),
values = values(c(0, 12, 18, 11, 5), dimension = "Concentration (mass)")
)
# Create observed data with units and error
obs <- create_observed_data(
name = "Subject 001",
time = time(c(0, 1, 2, 4, 8), unit = "h"),
values = values(
c(0, 12, 18, 11, 5),
unit = "mg/l",
dimension = "Concentration (mass)"
),
error = error(c(0, 1.2, 1.5, 1.1, 0.6), type = "ArithmeticStdDev")
)