get_ind_time_matrix: Generate a Ind x Time DataFrame from input data

View source: R/utils.R

get_ind_time_matrixR Documentation

Generate a Ind x Time DataFrame from input data

Description

Convert input data with each measurement as a row, to a data.frame of measurements with Individual as rows and Time as columns. Pairs of Individual and Timepoint without a measurement are left as NA. The resulting data.frame is employed as input for santaR_fit.

Usage

get_ind_time_matrix(Yi, ind, time, orderVect)

Arguments

Yi

vector of measurements

ind

vector of subject identifier (individual) corresponding to each measurement

time

vector of time corresponding to each measurement

orderVect

if provided, a vector of unique time to be used to order the time columns (otherwise rely on sort)

Value

data.frame of measurements for each IND x TIME. Rows are unique Individual IDs and columns unique measurement Time. Pairs of (IND,TIME) without a measurement are left as NA.

See Also

Other Analysis: get_grouping(), santaR_CBand(), santaR_auto_fit(), santaR_auto_summary(), santaR_fit(), santaR_plot(), santaR_pvalue_dist(), santaR_pvalue_fit(), santaR_start_GUI()

Examples

## 6 measurements, 3 subjects, 3 unique time-points
Yi   <- c(1,2,3,4,5,6)
ind  <- c('ind_1','ind_1','ind_1','ind_2','ind_2','ind_3')
time <- c(0,5,10,0,10,5)
get_ind_time_matrix(Yi, ind, time)
#        0  5 10
# ind_1  1  2  3
# ind_2  4 NA  5
# ind_3 NA  6 NA

## 56 measurements, 8 subjects, 7 unique time-points
Yi   <- acuteInflammation$data$var_1
ind  <- acuteInflammation$meta$ind
time <- acuteInflammation$meta$time
get_ind_time_matrix(Yi, ind, time)


santaR documentation built on May 24, 2022, 1:06 a.m.