paste_freq {utile.tools} | R Documentation |
Paste frequency
Description
Creates a formatted frequency from count(able) data. Automatically tallies non-numeric data types (nrow or length) and supports vectorized data methods.
Usage
paste_freq(x, y, na.rm = TRUE, percent.sign = TRUE, digits = 1)
Arguments
x |
A data.frame, numeric, or non-numeric. The numerator. |
y |
A data.frame, numeric, or non-numeric. The denominator. A single denominator may be used for multiple numerators or one denominator for each numerator. |
na.rm |
A logical. Whether to ignore NA's when tallying non-numeric data. |
percent.sign |
A logical. Indicates percent sign should be printed with frequencies. |
digits |
An integer. Number of digits to round to. |
Value
A character vector of count(s) with frequencies.
Examples
# Numeric
paste_freq(20, 100)
# data.frame
df <- data.frame(x = c(1:100), y = TRUE)
paste_freq(df[1:20,], df)
# Mixed data types
paste_freq(20, df)
# Single denominator for multiple numerators
paste_freq(c(10,20,30), 100)
[Package utile.tools version 0.3.0 Index]