as_deslist: Create a list of designs from a data frame

View source: R/class_tgrid.R

as_deslistR Documentation

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

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.

Value

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

Examples

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)


metrumresearchgroup/mrgsolve documentation built on Feb. 13, 2024, 10:27 p.m.