getCov: Processes domain data for merged covariates

View source: R/get_MappedColumns.R

getCovR Documentation

Processes domain data for merged covariates

Description

Processes domain data for merged covariates

Usage

getCov(.data, ID, cov.col, cov.val, cov.filter, cov.keys, fun.summary,
  Units, ...)

Arguments

.data

The domain data frame

ID

A column name or expression for the subject identifier

cov.col

The name of the column that holds the desired covariate names

cov.val

The name of the column that holds the covariate values

cov.filter

Filter expression to apply to subset the data

cov.keys

A character vector of the names of the columns to use as merge keys

fun.summary

A function name (or named list/vector) as a text string to use in summarising the ... column mappings over duplicate cov.keys

Units

The name of the column holding the covariate units (if stacked).

...

Additional column mappings.

Details

The input data is filtered, if a filter expression is provided. ID must be specified, but other arguments are optional. Provide cov.col and cov.val both to indicate that the data are in long format. In this case the values in cov.col (that remain after the filter is applied) will become new columns with the values specified in cov.val (a data widening operation). The ID and cov.keys columns will be repeated for each covariate value row.

If cov.col and cov.val are not provided, then after filtering the expressions given as additional column mappings will be selected from .data

cov.keys is used to group the output data for merging. Keys must be supplied. If multiple rows are returns per cov.keys grouping, a warning will be generated. Pass a function name in fun.summary to summarise values within each group. For example, there may be replicated samples and we want the mean of the samples for each subject and visit.

This function uses non-standard evaluation, so the ... arguments do not need to be quoted. For example, to compute a date from ISO-8601 strings include TIME=parsedate::parse_date(EXSTDTC). Of course the actual column may have a different name. Extra arguments (...) must be named, for example: MYVALUE = pmax(0,DV).

Value

A data_frame with the mapped data


qPharmetra/PMDatR documentation built on April 7, 2024, 5:42 p.m.