percent: Compute percent for a binary variable.

View source: R/variable_summaries.R

percentR Documentation

Compute percent for a binary variable.

Description

This is just shorthand for taking 100*mean(x).

Usage

percent(x, na.rm = FALSE)

Arguments

x

numeric vector or logical vector for which the percent of 1's is desired. NA and NaN values are not allowed in numeric vectors unless na.rm is TRUE.

na.rm

logical; if TRUE, any NA or NaN's are removed from x before the quantiles are computed.

Examples

summarize_variable(am ~ 1, data = mtcars, percent)


reyesem/IntroAnalysis documentation built on March 29, 2025, 3:29 p.m.