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
.
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
# 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)
#> 0 4 8 12 24 48
#> ind_1 -0.3402995 -0.2975866 -0.32753376 -0.18805090 -0.2293608 -0.3167715
#> ind_2 -0.3402995 4.6153098 0.70802309 0.31212530 -0.2466238 -0.2583461
#> ind_3 -0.4101337 -0.3455376 -0.41013374 -0.33124182 -0.3650980 -0.4101337
#> ind_4 -0.4101337 2.4984370 -0.15771390 -0.24400003 -0.3338180 -0.3370802
#> ind_5 -0.4101337 -0.3399216 -0.41013374 -0.32758869 -0.3407070 -0.3632320
#> ind_6 -0.4101337 2.6684152 -0.08955276 -0.18796505 -0.3177218 -0.3289509
#> ind_7 -0.4101337 -0.3001967 -0.36492017 -0.26852436 -0.3401291 -0.3251096
#> ind_8 -0.4101337 3.7773462 0.65175696 -0.04287806 -0.2787383 -0.2975552
#> 72
#> ind_1 -0.2352355
#> ind_2 -0.3032816
#> ind_3 -0.2877968
#> ind_4 -0.3330981
#> ind_5 -0.2843847
#> ind_6 -0.3260379
#> ind_7 -0.2837459
#> ind_8 -0.3135763