get_group_n: Formatted Group Sample Size for Tables

View source: R/freq_group_n.R

get_group_nR Documentation

Formatted Group Sample Size for Tables

Description

Given a tibble and a filter expression, get_group_n returns the group sample size formatted as "N = XXXX". Made to work in a dplyr pipeline, and used when creating tables for publications / reports.

Usage

get_group_n(.data, ...)

Arguments

.data

A data frame or tibble

...

A dplyr::filter expression. Used to select subgroup.

Value

A character string

Examples

library(dplyr)
library(freqtables)

data(mtcars)

# Get sample size for cars with 4 cylinders
mtcars %>% get_group_n(cyl == 4)

#> [1] "N = 11"

freqtables documentation built on April 3, 2022, 5:11 p.m.