50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


healthyR (version 0.2.0)

category_counts_tbl: Counts by Category

Description

Get the counts of a column by a particular grouping if supplied, otherwise just get counts of a column.

Usage

category_counts_tbl(.data, .count_col, .arrange_value = TRUE, ...)

Arguments

.data

The data.frame/tibble supplied.

.count_col

The column that has the values you want to count.

.arrange_value

Defaults to true, this will arrange the resulting tibble in descending order by .count_col

...

Place the values you want to pass in for grouping here.

Author

Steven P. Sanderson II, MPH

Details

  • Requires a data.frame/tibble.

  • Requires a value column, a column that is going to counted.

Examples

Run this code
library(healthyR.data)
library(dplyr)

healthyR_data %>%
  category_counts_tbl(
    .count_col = payer_grouping
    , .arrange = TRUE
    , ip_op_flag
  )

healthyR_data %>%
  category_counts_tbl(
    .count_col = ip_op_flag
    , .arrange_value = TRUE
    , service_line
  )

Run the code above in your browser using DataLab