Learn R Programming

utile.tools (version 0.2.7)

paste_freq: Paste frequency

Description

Creates a human-readable 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)

Value

A character vector of count(s) with frequencies.

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.

Examples

Run this code
# 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)

Run the code above in your browser using DataLab