View source: R/addCategories.R
addCategories | R Documentation |
Categorize a numeric variable
addCategories(
x,
variable,
categories,
missingCategoryValue = "None",
overlap = FALSE,
name = NULL
)
x |
Table with individuals in the cdm. |
variable |
Target variable that we want to categorize. |
categories |
List of lists of named categories with lower and upper limit. |
missingCategoryValue |
Value to assign to those individuals not in any named category. If NULL or NA, missing will values will be given. |
overlap |
TRUE if the categories given overlap. |
name |
Name of the new table, if NULL a temporary table is returned. |
The x table with the categorical variable added.
cdm <- mockPatientProfiles()
result <- cdm$cohort1 %>%
addAge() %>%
addCategories(
variable = "age",
categories = list("age_group" = list(
"0 to 39" = c(0, 39), "40 to 79" = c(40, 79), "80 to 150" = c(80, 150)
))
)
mockDisconnect(cdm = cdm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.