describeProp: A function that returns a description proportion that...

Description Usage Arguments Value See Also Examples

View source: R/descriptionStats.R

Description

A function that returns a description proportion that contains the number and the percentage

Usage

1
2
3
4
describeProp(x, html = FALSE, digits = 1, number_first = TRUE,
  show_missing = FALSE, show_missing_digits = digits,
  horizontal_proportions = NULL, default_ref = "First",
  percentage_sign = TRUE, language = "en", ...)

Arguments

x

The variable that you want the statistics for

html

If HTML compatible output shoudl be used instead of default LaTeX

digits

The number of decimals used

number_first

If the number should be given or if the percentage should be presented first. The second is encapsulated in parentheses (). This is only used together with the show_missing variable.

show_missing

This indicates if missing should be added as a separate row below all other.

show_missing_digits

The number of digits to use for the missing percentage, defaults to the overall digits.

horizontal_proportions

Is only active if show_missing since this is the only case of a proportion among continuous variables. This is default NULL and indicates that the proportions are to be interpreted in a vertical manner. If we want the data to be horizontal, i.e. the total should be shown and then how these differ in the different groups then supply the function with the total number in each group, i.e. if done in a by manner as in getDescriptionStatsBy it needs to provide the number before the by() command. Note! This calls the describeFactors since the horizontal interpretation looses the vertical information in the second category and is thus better interpreted as a whole.

default_ref

If you use proportions with only one variable it can be useful to set the reference level that is of interest to show. This can wither be "First", level name or level number.

percentage_sign

If you want to suppress the percentage sign you can set this variable to FALSE. You can also choose something else that the default % if you so wish by setting this variable. Note, this is only used when combined with the missing information.

language

The ISO-639-1 two-letter code for the language of interest. Currently only english is distinguished from the ISO format using a ',' as the separator in the outputInt function.

...

Passed on to outputInt

Value

A string formatted for printing either latex by HTML

See Also

getDescriptionStatsBy, describeFactors

Other description functions: describeFactors; describeMean; describeMedian

Examples

1
2
describeProp(factor(sample(50, x=c("A","B"), replace=TRUE)))
describeProp(factor(sample(50, x=c("A","B", NA), replace=TRUE)), show_missing=TRUE)

raredd/Gmisc0 documentation built on May 27, 2019, 2:02 a.m.