sumstat | R Documentation |
Provide the summary statistics of an R object
.sumstat(x, fmt, ...)
## Default S3 method:
.sumstat(x, fmt = "%.2f", ...)
## S3 method for class 'factor'
.sumstat(x, ...)
## S3 method for class 'ordered'
.sumstat(x, ...)
## S3 method for class 'character'
.sumstat(x, ...)
## S3 method for class 'logical'
.sumstat(x, ...)
x |
an R object |
fmt |
(optional) character scalar, only for function .sumstat.default, see function sprintf |
... |
additional parameters, currently not in use |
Function .sumstat.default()
accepts all R objects of typeof double and integer.
Statistics of mean, sd and range are reported.
If the normality assumption via shapiro.test is not satisfied, then median and mad are also reported.
Function .sumstat()
returns a character scalar.
x = c(rpois(n = 20L, lambda = 2), NA_integer_)
.sumstat(x)
# factor
x = state.region
x[2L] = NA_integer_
.sumstat(x)
# binary
.sumstat(c(TRUE, FALSE, TRUE, NA))
.sumstat(c(TRUE, FALSE, TRUE))
.sumstat(c(FALSE, FALSE, NA))
.sumstat(c(FALSE, FALSE, FALSE))
.sumstat(c(NA, NA, NA))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.