Summarize a Variable in a Long Dataset by ID
.summary.ID(data, var, idvar, CI = 0.95, robust = FALSE)
A data.table object with the mean/median, lower limit, and upper limit of the variable
specified in var
for each level of the grouping variable specified in idvar
.
A data.table object, long format
A character string, the name of the variable to summarize
A character string, the name of the grouping variable
A numeric value, the confidence interval to use. Default is .95.
A logical. Default is FALSE
.
If TRUE
, the function will use the median as the estimate.
If FALSE
, the function will use the mean as the estimate.