Description Usage Arguments Value Details See Also Examples
age_categorize
conveniently generates commonly used age groups from a continuous age variable
1 | age_categorize(df, col_name = NULL, method = NULL, var_name = NULL)
|
df |
data frame containing an |
col_name |
a string character of the |
method |
is a |
returns a data frame
with new factor
column of labels for the
specified age-groups.
There are five pre-established age groups that can be specified using the methods
parameter.
Method 1
: 0, 1, ..., 119, 120+ (single year age groups)
Method 2
: <1, 0-4, ..., 70-74, 75+ (5 year age groups)
Method 3
: 0-4, 5-9, ..., 70-74, 75+ (5 year age groups)
Method 4
: <1, 1-4, ..., 95-99, 100+ (5 year age groups)
Method 5
: 0-4, 5-9, ..., 75-79, 80+ (UN demogratic standard)
Method 6
: 0-4, 5-9, 10-14, 15-59, 60+ (broad age groups)
Method 7
: 0-14, 15-59, 60+ (broad age groups)
The new column is generated using the mutate
function from the dplyr
package.
1 2 3 4 5 6 | ## Use of the \code{schizophrenia} dataset from the \code{HSAUR} package
## Not run:
require(HSAUR)
age_categorize(schizophrenia, col_name = "age", method = 5)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.