Description Usage Arguments Details Value Examples
Takes in up to 3 numeric values, rounds each to a specified digit amount (if numeric), and then combines them accordingly.
1 2 3 | stat_paste(stat1, stat2 = NULL, stat3 = NULL, digits = 0,
trailing_zeros = TRUE, bound_char = c("(", "[", "{", "|"),
sep = ", ", na_str_out = "---")
|
stat1 |
first statistic to be pasted. |
stat2 |
second statistic to be pasted (optional). |
stat3 |
third statistic to be pasted (optional). |
digits |
positive integer of length 1 between 0 (default) and 14, giving the amount of digits to round to. |
trailing_zeros |
logical indicating if trailing zeros should included (i.e. 0.100 instead of 0.1). Note is set to TRUE output is a character vector |
bound_char |
the character to be used between stat1 and stat2/stat3. Available options are '(' (default), '[', '{', and '|'. |
sep |
the string to be used between stat2 and stat3. The default is ', '. |
na_str_out |
the character to replace missing values with. |
One value provided - returns a rounded value or the missing character. Two values - returns stat1 (stat2). e.g., mean (sd) Three values - returns stat1 (stat2, stat3). e.g., estimate (95% lower, 95% upper) or median [min, max]
Currently the method does work with string variables, but of course rounding would not be relevant for strings.
string of combined values
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | stat_paste(5.109293)
stat_paste(NA)
stat_paste(5.109293, 2.145)
stat_paste(5.109293, 1.7645, 8.0345)
stat_paste(NA, NA, NA)
stat_paste(5.109, "p < 0.001", digits = 3)
stat_paste(c(rep(5,5),NA),c(1:5,NA),c(1,NA,2,NA,3,NA),bound_char = '[')
library(data.table)
data(testData_BAMA)
testData_BAMA [!is.na(magnitude), .(
median_min_max = stat_paste(
median(magnitude), min(magnitude), max(magnitude)
)), by = .(antigen, visit, group)]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.