Facet app inputs
pull_facet_cols.Rd
Facet app inputs
Variables to use for facets
This function is designed to quickly determine which variables have an
appropriate number of categorical levels for using ggplot2::facet_wrap()
or ggplot2::facet_grid()
Examples
require(dplyr)
require(NHANES)
#> Loading required package: NHANES
#> Warning: there is no package called ‘NHANES’
pull_facet_cols(df = dplyr::starwars)
#> sex
#> "sex"
pull_facet_cols(df = NHANES::NHANES)
#> Error in purrr::map(.x = class, .f = col_class, df = df): ℹ In index: 1.
#> Caused by error in `loadNamespace()`:
#> ! there is no package called ‘NHANES’
str(dplyr::select(
dplyr::starwars,
dplyr::all_of(pull_facet_cols(df = dplyr::starwars))
))
#> tibble [87 × 1] (S3: tbl_df/tbl/data.frame)
#> $ sex: chr [1:87] "male" "none" "none" "male" ...
str(dplyr::select(
NHANES::NHANES,
dplyr::all_of(pull_facet_cols(df = NHANES::NHANES))
))
#> Error in loadNamespace(x): there is no package called ‘NHANES’