View source: R/TSDT_helper_functions.R
get_covariates | R Documentation |
Returns the covariate variables in the in-bag or out-of-bag data.
get_covariates(data, scoring_function_parameters)
data |
A data.frame containing in-bag or out-of-bag data |
scoring_function_parameters |
A list of named elements containing control parameters and other data required by the scoring function |
If the user provides a covariate_vars parameter in the list of scoring_function_parameters this function will return the variables specified by that parameter. If the user specifies a covariate_cols parameter in the list of scoring_function_parameters the function returns the columns in data indexed by that parameter. Otherwise, NULL is returned.
A data.frame of covariates.
get_y, get_trt
## Create an example data.frame df <- data.frame( y <- 1:5 ) names( df ) <- "y" df$time <- 10:14 df$time2 <- 20:24 df$event <- sample( c(0:1), size = 5, replace = TRUE ) df$trt <- sample( c("Control","Treatment"), size = 5, replace = TRUE ) df$x1 <- runif( n = 5 ) df$x2 <- LETTERS[1:5] ## Select the covariate variables by name get_covariates( df, scoring_function_parameters = list( covariate_vars = c("x1","x2") ) ) ## Select the covariate variables by column index get_covariates( df, scoring_function_parameters = list( covariate_cols = c(6:7) ) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.