summ_prop: Create count with proportion as string

View source: R/summ_prop.R

summ_propR Documentation

Create count with proportion as string

Description

Create count with proportion as string

Usage

summ_prop(
  x,
  category = NULL,
  omit_na = T,
  digits = 1,
  incl_denom = F,
  out = c("percentage", "percent"),
  perc_disp = F,
  escape = F,
  zero2dash = T
)

Arguments

x

vector

category

Category to count x matches (not required if x logical)

omit_na

logical for removal of missing values when reporting porportion

digits

number of digits to round

incl_denom

logical for inclusion of denominator in frequency

out

single character representing output for proportion

perc_disp

logical for inclusion of % sign

escape

logical for inclusion of escape character for LaTeX tables

zero2dash

logical for returning "-" instead of "0 (0)" for tables

Value

Character String of the form "N ( % )"

Examples

x = sample(1:3, size = 20, replace = T)
summ_prop(x, category = 2,digits = 3)
summ_prop(x, category = 1, out = "percent")
summ_prop(x == 1)
summ_prop(x %in% 1:3)

Ajfrick/ajfhelpR documentation built on June 30, 2023, 12:56 a.m.