stringify_frequency: Combine elements of a frequency table into a (character)...

Description Usage Arguments Details Value Examples

View source: R/stringify_frequency.R

Description

Combine elements of a frequency table into a (character) string.

Usage

1
2
stringify_frequency(data, expl_text, element_number = 10, sort = TRUE,
  item_sep = "/", text_col = NA, number_col = NA, ndigit = 3)

Arguments

data

frequency table (table(x) output).

expl_text

text which is to be appended at the end of the string (e.g. "(Percent of diagnoses)") (character).

element_number

number of rows of the frequency table which are to be included (integer) [default:10].

sort

whether to sort the frequency table (descending order) (logical - TRUE/FALSE) [default: TRUE].

item_sep

symbol used to separate the elements in the string (character) [default: "//"].

text_col

name of text column (character) [default: automatically identify column based on column types].

number_col

name of number column (character) [default: automatically identify column based on column types].

Details

Maintained by: Clara Marquardt

Value

formatted (character) string or data.table.

Examples

1
2
3
data_raw  <- prop.table(table(dia$dia_name))*100
freq_string <- stringify_frequency(data=data_raw, expl_text="Percent of Principal Diagnoses (%)", element_number=5, sort=TRUE, item_sep="//", ndigit=3)
print(freq_string)

ClaraMarquardt/ehR documentation built on Sept. 17, 2017, 6:05 p.m.