The FCDS data set includes a number of thematically-groups variables. This function helps select those groups by returning variable names.
fcds_vars(..., .data = NULL)
... | Variable group names, as characters. Partial matching is allowed
and the matching is not case-sensitive. Possible variable groups include
A group may be input multiple times, but only the first appearance will be
used. The final variable list is ordered by the requested group, unless
|
---|---|
.data | If `.data`` is included, then the variables in the input data are subset to only those appearing in the selected groups, in the order they appear in the original data. |
A character vector of column names, or, if .data
is provided, a
data frame subset to include columns matching the requested groups.
fcds_vars("demo")#> [1] "age_group" "race" "sex" "origin" #> [5] "marital_status" "birth_country" "birth_state" "primary_payer"fcds_vars("demographics")#> [1] "age_group" "race" "sex" "origin" #> [5] "marital_status" "birth_country" "birth_state" "primary_payer"fcds_vars("id", "demo", "pop")#> [1] "patient_id" "year_group" "year" "age_group" #> [5] "race" "sex" "origin" "marital_status" #> [9] "birth_country" "birth_state" "primary_payer" "county_name" #> [13] "county_fips" "state" "florida_resident" "country"fcds_vars("seer", "tobacco", "seer")#> [1] "seer_stage_1977" "seer_stage_2000" #> [3] "seer_stage" "seer_stage_derived_1977" #> [5] "seer_stage_derived_2000" "tobacco_cigarette" #> [7] "tobacco_other" "tobacco_smokeless" #> [9] "tobacco_nos"dplyr::tibble( patient_id = 1:5, year = 2000, county_name = "Pinellas", age_group = c("65 - 69", "10 - 14", "25 - 29", "70 - 74", "40 - 44"), cancer_status = c("Evidence of tumor", "Unknown", "No evidence of tumor", "No evidence of tumor", "No evidence of tumor") ) %>% fcds_vars(.data = ., "id", "pop", "demo")#> # A tibble: 5 x 4 #> patient_id year county_name age_group #> <int> <dbl> <chr> <chr> #> 1 1 2000 Pinellas 65 - 69 #> 2 2 2000 Pinellas 10 - 14 #> 3 3 2000 Pinellas 25 - 29 #> 4 4 2000 Pinellas 70 - 74 #> 5 5 2000 Pinellas 40 - 44