get_group_n: Formatted Group Sample Size for Tables

Description Usage Arguments Value Examples

View source: R/get_group_n.R

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

1
get_group_n(.data, ...)

Arguments

.data

A data frame or tibble

...

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

Value

A character string

Examples

1
2
3
4
5
6
7
8
9
library(tidyverse)
library(bfuncs)

data(mtcars)

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

#> [1] "N = 11"

brad-cannell/my_functions documentation built on July 25, 2019, 4:29 p.m.