Skip to contents

Describe unique values in a data frame

Usage

describe_unique(
  df,
  ...,
  .rename_first = "value",
  .set_names = NULL,
  .names_to = "variable"
)

Arguments

df

data frame

...

unquoted data frame columns

.rename_first

default is "value"

.set_names

vector of names

.names_to

default is "variable"

Value

a data frame with unique values

Examples


describe_unique(mock_forager(), class, payer)
#> # A tibble: 7 × 3
#>   variable value         n
#>   <chr>    <chr>     <int>
#> 1 class    Secondary     7
#> 2 class    Primary       3
#> 3 payer    Humana        4
#> 4 payer    Centene       2
#> 5 payer    Cigna         2
#> 6 payer    MAO           1
#> 7 payer    Medicare      1

describe_unique(
  mock_forager(50),
  names(mock_forager())[c(2:3, 6:9)]) |>
  dplyr::filter(n > 2) |>
  print(n = 30)
#> # A tibble: 18 × 3
#>    variable             value          n
#>    <chr>                <chr>      <int>
#>  1 payer                Medicaid       8
#>  2 payer                Centene        7
#>  3 payer                Anthem         6
#>  4 payer                BCBS           6
#>  5 payer                Medicare       6
#>  6 payer                Cigna          5
#>  7 payer                UHC            5
#>  8 payer                Humana         4
#>  9 payer                MAO            3
#> 10 class                Secondary     28
#> 11 class                Primary       22
#> 12 date_of_release      2024-05-04     3
#> 13 date_of_release      2024-08-03     3
#> 14 date_of_release      2024-08-05     3
#> 15 date_of_submission   2024-08-06     3
#> 16 date_of_acceptance   2024-08-08     3
#> 17 date_of_acceptance   2025-01-10     3
#> 18 date_of_adjudication 2024-09-08     3