Learn R Programming

dMod (version 1.0.0)

datalist: Generate a datalist object

Description

The datalist object stores time-course data in a list of data.frames. The names of the list serve as identifiers, e.g. of an experimental condition, etc.

Usage

datalist(...)

as.datalist(x, ...)

# S3 method for data.frame as.datalist(x, split.by = NULL, keep.covariates = NULL, ...)

# S3 method for list as.datalist(x, names = NULL, ..., condition.grid = attr(x, "condition.grid"))

# S3 method for datalist names(x) <- value

is.datalist(x)

# S3 method for datalist c(...)

Arguments

...

data.frame objects to be coerced into a list and additional arguments

x

object of class data.frame or list. Data frames are required to provide "name", "time" and "value" as columns. Columns "sigma" and "lloq" can be provided. If "sigma" and "lloq" are missing, they are imputed with NA and -Inf, respectively.

split.by

vector of columns names which yield a unique identifier (conditions). If NULL, all columns except for the expected standard columns "name", "time", "value", "sigma" and "lloq" will be selected.

keep.covariates

vector of additional column names which should be kept in the condition.grid.

names

optional names vector, otherwise names are taken from mylist

condition.grid

Optionally, to manually specify a condition.grid

value

The new condition names of the datalist and its condition.grid

Value

Object of class datalist.

Object of class datalist

Details

Datalists can be plotted, see plotData and merged, see sumdatalist. They are the basic structure when combining model prediction and data via the normL2 objective function.

The standard columns of the datalist data frames are "name" (observable name), "time" (time points), "value" (data value), "sigma" (uncertainty, can be NA), and "lloq" (lower limit of quantification, -Inf by default).

Datalists carry the attribute condition.grid which contains additional information about different conditions, such as dosing information for the experiment. It can be conveniently accessed by the covariates-function. Reassigning names to a datalist also renames the rows of the condition.grid.

Examples

Run this code
# NOT RUN {
## Generate datalist from scratch
mydata1 <- data.frame(name = "A",
                      time = 0:5,
                      value = 0:5,
                      sigma = .1,
                      lloq = -0.5)

mydata2 <- data.frame(name = "A",
                      time = 0:5,
                      value = sin(0:5),
                      sigma = .1)

data <- datalist(C1 = mydata1, C2 = mydata2)
print(data)
plot(data)

## Generate datalist from singla data.frame
times <- seq(0, 2*pi, length.out = 20)
mydata <- data.frame(name = "A", 
                     time = times, 
                     value = c(sin(times), 1.5 * sin(times)), 
                     sigma = .1, 
                     stage = rep(c("upper", "lower"), each = 10),
                     phase = rep(c("first", "second"), each = 20),
                     amplitude = rep(c(1,1.5), each = 20))

data <- as.datalist(mydata, split.by = c("stage", "phase"), keep.covariates = "amplitude")
print(data)
plot(data)

condition.grid <- attr(data, "condition.grid")
print(condition.grid)
# }

Run the code above in your browser using DataLab