All functions in this package are deprecated. Please use the
{cocoon}
package instead.
format_bf()
can input either a
BayesFactor
object or a vector of Bayes factor values. By default, this function rounds
Bayes factors greater than 1 to one decimal place and Bayes factors less
than 1 to two decimal places. Values greater than 1000 or less than 1/1000
are formatted using scientific notation. Cutoffs can be set that format the
values as greater than or less than the cutoffs (e.g., BF > 1000 or
BF < 0.001). Numbers of digits, cutoffs, italics, and label subscripts are
all customizable.
Usage
format_bf(
x,
digits1 = 1,
digits2 = 2,
cutoff = NULL,
label = "BF",
italics = TRUE,
subscript = "10",
type = "md"
)
Arguments
- x
BayesFactor object or vector of numeric Bayes factor values
- digits1
Number of digits after the decimal for Bayes factors > 1
- digits2
Number of digits after the decimal for Bayes factors < 1
- cutoff
Cutoff for using
_BF_~10~ > <cutoff>
or_BF_~10~ < 1 / <cutoff>
(value must be > 1)- label
Character string for label before Bayes factor. Default is BF. Set
label = ""
to return just the formatted Bayes factor value with no label or operator (=
,<
,>
)- italics
Logical for whether label should be italicized (BF or BF)
- subscript
Subscript to include with BF label (
"10"
,"01"
, or""
for no subscript)- type
Type of formatting (
"md"
= markdown,"latex"
= LaTeX)
Value
A character string that includes label (by default BF~10~) and then the
Bayes factor formatted in Markdown or LaTeX. If Bayes factor is above or
below cutoff
, _BF_~10~ > <cutoff>
or _BF_~10~ < 1 / <cutoff>
is used.
Examples
# Format Bayes factors > 1
format_bf(12.4444)
#> Warning: `format_bf()` was deprecated in formatstats 0.0.0.9000.
#> ℹ Please use `cocoon::format_bf()` instead.
#> Warning: `format_scientific()` was deprecated in formatstats 0.0.0.9000.
#> ℹ Please use `cocoon::format_scientific()` instead.
#> ℹ The deprecated feature was likely used in the formatstats package.
#> Please report the issue at
#> <https://github.com/JeffreyRStevens/formatstats/issues>.
#> Warning: `format_num()` was deprecated in formatstats 0.0.0.9000.
#> ℹ Please use `cocoon::format_num()` instead.
#> ℹ The deprecated feature was likely used in the formatstats package.
#> Please report the issue at
#> <https://github.com/JeffreyRStevens/formatstats/issues>.
#> [1] "_BF_~10~ = 12.4"
# Bayes factors > 1000 will use scientific notation
format_bf(1244.44)
#> [1] "_BF_~10~ = 1.2×10^3^"
# Control digits for Bayes factors > 1 with digits1
format_bf(1244.44, digits1 = 3)
#> [1] "_BF_~10~ = 1.244×10^3^"
# Control cutoff for output
format_bf(1244.44, cutoff = 10000)
#> [1] "_BF_~10~ = 1244.4"
# Format Bayes factors < 1
format_bf(0.111)
#> [1] "_BF_~10~ = 0.11"
# Bayes factors < 0.001 will use scientific notation
format_bf(0.0001)
#> [1] "_BF_~10~ = 1.0×10^-4^"
# Control digits for Bayes factors < 1 with digits2
format_bf(0.111, digits2 = 3)
#> [1] "_BF_~10~ = 0.111"
# Control cutoff for output
format_bf(0.001, cutoff = 100)
#> [1] "_BF_~10~ < 0.01"
# Return only Bayes factor value (no label)
format_bf(12.4444, label = "")
#> [1] "12.4"