summaryText {DemographicTable}R Documentation

Summary Text

Description

Provide the summary text of an R object

Usage

summaryText(x, fmt, ...)

## Default S3 method:
summaryText(x, fmt = "%.2f", ...)

## S3 method for class 'factor'
summaryText(x, fmt = "%.1f", useNA = c("no", "always"), ...)

## S3 method for class 'ordered'
summaryText(x, fmt = "%.1f", useNA = c("no", "always"), ...)

## S3 method for class 'character'
summaryText(x, ...)

## S3 method for class 'logical'
summaryText(x, fmt = "%.1f", ...)

Arguments

x

an R object

fmt

character scalar, format string, see sprintf

...

additional parameters, currently not in use

useNA

character scalar, 'no' (default) or 'always', see table

Value

Function summaryText returns a character scalar.

Examples

x = rpois(n = 20L, lambda = 2)
x[sample.int(length(x), 3L)] = NA_integer_
summaryText(x)

# factor 
x = state.region
x[2L] = NA_integer_
summaryText(x)

# binary
summaryText(c(TRUE, FALSE, TRUE, NA))
summaryText(c(TRUE, FALSE, TRUE))
summaryText(c(FALSE, FALSE, NA))
summaryText(c(FALSE, FALSE, FALSE))
summaryText(c(NA, NA, NA))


[Package DemographicTable version 0.1.7 Index]