Last chance! 50% off unlimited learning
Sale ends in
frmt(x, digits = getOption("qwraps2_frmt_digits", 2))
frmtp(x, style = getOption("qwraps2_journal", "default"), digits = getOption("qwraps2_frmtp_digits", 4), markup = getOption("qwraps2_markup", "latex"), case = getOption("qwraps2_frmtp_case", "upper"), leading0 = getOption("qwraps2_frmtp_leading0", TRUE))
frmtci(x, est = 1, lcl = 2, ucl = 3, format = "est (lcl, ucl)", show_level = FALSE, ...)
is.integer(x) == TRUE)
.format
is the
default, then
"100*(1-options()$qwraps2_alpha)
parenthesis and the lcl. If set to a string, then the given string will be
placed between the left parenthesis and the lcl. If the format
is not
the default, then this argument is ignored.formatC
.`frmtp` formats P-values per journal requirements. As I work on papers aimed at different journals, the formatting functions will be extended to match.
Default settings are controlled through the function arguments but should be
set via options()
.
Default settings report the P-value exactly if P >
getOptions("qwraps2_frmtp_digits", 4)
and reports
P < 10^-(getOptions("qwraps2_frmtp_digits", 2))
otherwise. By the
leading zero is controlled via
getOptions("qwraps2_frmtp_leading0", TRUE)
and a upper or lower case P is controlled by
getOptions("qwraps2_frmtp_case", "upper")
. These options are ignored
if style != "default"
.
Journals with predefined P-value formatting are noted in the qwraps2 documentation.
`frmtci` takes a matrix
, or data.frame
, with a point estimate
and the lcl and ucl and formats a string for reporting. est (lcl, ucl) is
the default. The confidence level can be added to the string, e.g., "est
(95
format.
`frmtcip` expects four values, est, lcl, ucl, and p-value. The resulting sting will be of the form "est (lcl, ucl; p-value)".
formatC
# Formatting numbers
integers <- c(1234L, 9861230L)
numbers <- c(1234, 9861230)
frmt(integers) # no decimal point
frmt(numbers) # decimal point and zeros to the right
numbers <- c(0.1234, 0.1, 1234.4321, 0.365, 0.375)
frmt(numbers)
# Formatting p-values
ps <- c(0.2, 0.001, 0.00092, 0.047, 0.034781, 0.0000872, 0.787, 0.05, 0.043)
# LaTeX is the default markup language
cbind("raw" = ps,
"default" = frmtp(ps),
"3lower" = frmtp(ps, digits = 3, case = "lower"),
"PediDent" = frmtp(ps, style = "pediatric_dentistry"))
# Using markdown
cbind("raw" = ps,
"default" = frmtp(ps, markup = "markdown"),
"3lower" = frmtp(ps, digits = 3, case = "lower", markup = "markdown"),
"PediDent" = frmtp(ps, style = "pediatric_dentistry", markup = "markdown"))
# Formatting the point estimate and confidence interval
# for a set of three values
temp <- c(a = 1.23, b = .32, CC = 1.78)
frmtci(temp)
frmtci(temp, show_level = TRUE)
# note that the show_level will be ignored in the following
frmtci(temp, format = "est ***lcl, ucl***", show_level = TRUE)
# show_level as a character
frmtci(temp, show_level = "confidence between: ")
# For a matrix: the numbers in this example don't mean anything, but the
# formatting should.
temp2 <- matrix(rnorm(12), nrow = 4,
dimnames = list(c("A", "B", "C", "D"), c("EST", "LOW", "HIGH")))
temp2
frmtci(temp2)
Run the code above in your browser using DataLab