surv_gethr | R Documentation |
The purpose of this function is so that the user can easily extract hazard ratios, hazard ratio confidence intervals, and hazard ratio pvalues easily. This function also outputs Hazard Ratios that can easily be added plots
surv_gethr(fit, vars, names = NULL, ndec = 4)
fit |
coxph model |
vars |
character vector including the covariates fo the cox model that we would like to extract hazard ratios for. Note: if a covariate was wrapped, for example tt(age_wk), the wrapping and the variable should be included |
names |
character vector of same length as vars that provides formal names for the variables in place of variable name. |
ndec |
numeric that specifies the number of decimal places to round the hazard ratios |
hr_table |
a dataframe whos rows correspond the variables inputted by the vars argument and whos names are determined by the names argument. If the names argument is not given the names are the same as the variable names. This dataframe has the following columns (1) value - provides the hazard ratio (2) lower - lower bound of 95 (3) upper - upper bound of 95 (4) pval - the p-value for the hazard ratio (5) final - a character stirng that includes columns 1-4 for table output (6) with_names - character string like final, but the variable name is included |
hr_text |
a character string that has the with names for each variable separated by \n, so that the hazard ratios for vars can be included in a kaplan meier plot. |
William Mueller, Eric J. Shiroma
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.