Learn R Programming

mrgsolve (version 1.5.1)

as_deslist: Create a list of designs from a data frame

Description

Create a list of designs from a data frame

Usage

as_deslist(data, descol = "ID")

Value

The function returns a list of tgrid objects, one for each unique value found in descol.

Arguments

data

input data set; see details

descol

character column name to be used for design groups

Details

The input data set must have a column with the same name as the value of descol. Other column names should be start (the time of the first observation), end (the time of the last observation), delta (the time steps to take between start and end), and add (other, ad-hoc times). Note that add might be a list-column to get a vector of times for each time grid object.

Examples

Run this code
idata <- tibble::tibble(ID=1:4, end=seq(24,96,24), delta=6,
add=list(c(122,124,135),c(111), c(99),c(88)))

idata <- dplyr::mutate(idata, GRP = ID %%2)

idata

l <- as_deslist(idata,"GRP")

l

lapply(l,stime)

lapply(as_deslist(idata, "ID"),stime)

Run the code above in your browser using DataLab