Description Usage Arguments Details Value Note Author(s) See Also Examples
Format the median and interquartile range as either “median (Q1 to Q3)” or “median (Q1, Q3)”; format the median and range similarly; format the mean and SD as “mean (SD)”.
1 2 3 4 5 6 7 8 9 10 11 12 | ## S3 method for class 'medIQR'
format(x, digits = 2, format = "f", isep = " to ", ...)
## S3 method for class 'medIQR'
print(x, quote = FALSE, ...)
## S3 method for class 'medR'
format(x, digits = 2, format = "f", isep = " to ", ...)
## S3 method for class 'medR'
print(x, quote = FALSE, ...)
## S3 method for class 'meanSD'
format(x, digits = 2, format = "f", isep = " to ", ...)
## S3 method for class 'meanSD'
print(x, quote = FALSE, ...)
|
x |
The object to format or print. |
digits |
The number of digits to display. This is passed to
|
format |
The style of formatting. This is passed to
|
isep |
The interval separator, or how the quartiles should be separated. By default, the quartiles are separated by the word to as in “(Q1 to Q3)”. An alternative is to separate the quartiles with a comma as in “(Q1, Q3)”. These are both preferred to separating the quartiles with a dash which is easily confused with a negative sign. |
quote |
Logical, indicating whether or not strings should be printed with surrounding quotes. |
... |
Other arguments passed to |
The convention of many biomedical journals is to summarize a distribution using a shorthand notation of the form “median (IQR)” or “mean (SD)”. For example, some journal text might read “... the median (IQR) age of the treated group was 55 (32 to 81) ...” while a table stub might read “Age, median (IQR), years”. This function facilitates this shorthand.
For univariate summaries, the formatted result is a character vector
of length one. For conditional summaries as given by the formula
method, the formatted result is a one-row matrix with informative
dimnames
. The print method returns x
invisibly.
Formatting and rounding floating point numbers is
complicated. Important ideas are the number of significant digits
versus number of decimal places to display, the round-to-even rule,
and the fact that some numbers (even “simple” ones like like
0.15
) cannot be represented exactly and thus may not be rounded
or formatted as some users expect.
Stephen Weigand Weigand.Stephen@mayo.edu
medIQR
, medR, and
meanSD; formatC
, format
.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.