Learn R Programming

ggpmisc (version 0.6.0)

plain_label: Format numbers as character labels

Description

These functions format numeric values as character labels including the symbol for statistical parameter estimates suitable for adding to plots. The labels can be formatted as strings to be parsed as plotmath expressions, or encoded using LaTeX or Markdown.

Usage

plain_label(
  value,
  value.name,
  digits = 3,
  fixed = FALSE,
  output.type = "expression",
  decimal.mark = getOption("OutDec", default = ".")
)

italic_label( value, value.name, digits = 3, fixed = FALSE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

bold_label( value, value.name, digits = 3, fixed = FALSE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

p_value_label( value, small.p = getOption("ggpmisc.small.p", default = FALSE), subscript = "", superscript = "", digits = 4, fixed = NULL, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

f_value_label( value, df1 = NULL, df2 = NULL, digits = 4, fixed = FALSE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

t_value_label( value, df = NULL, digits = 4, fixed = FALSE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

z_value_label( value, digits = 4, fixed = FALSE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

S_value_label( value, digits = 4, fixed = FALSE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

mean_value_label( value, digits = 4, fixed = FALSE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

var_value_label( value, digits = 4, fixed = FALSE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

sd_value_label( value, digits = 4, fixed = FALSE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

se_value_label( value, digits = 4, fixed = FALSE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

r_label( value, method = "pearson", small.r = getOption("ggpmisc.small.r", default = FALSE), digits = 3, fixed = TRUE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

rr_label( value, small.r = getOption("ggpmisc.small.r", default = FALSE), digits = 3, fixed = TRUE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

adj_rr_label( value, small.r = getOption("ggpmisc.small.r", default = FALSE), digits = 3, fixed = TRUE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

rr_ci_label( value, conf.level, range.brackets = c("[", "]"), range.sep = NULL, digits = 2, fixed = TRUE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

r_ci_label( value, conf.level, small.r = getOption("ggpmisc.small.r", default = FALSE), range.brackets = c("[", "]"), range.sep = NULL, digits = 2, fixed = TRUE, output.type = "expression", decimal.mark = getOption("OutDec", default = ".") )

Value

A character string with formatting, encoded to be parsed as an R plotmath expression, as plain text, as markdown or to be used with

\(LaTeX\) within math mode.

Arguments

value

numeric The value of the estimate.

value.name

character The symbol used to represent the value, or its name.

digits

integer Number of digits to which numeric values are formatetd.

fixed

logical Interpret digits as indicating a number of digits after the decimal mark or as the number of significant digits.

output.type

character One of "expression", "latex", "tex", "text", "tikz", "markdown".

decimal.mark

character Defaults to the value of R option "OutDec".

small.p, small.r

logical If TRUE use lower case (\(p\) and \(r\), \(r^2\)) instead of upper case (\(P\) and \(R\), \(R^2\)),

subscript, superscript

character Text for a subscript and superscript to P symbol.

df, df1, df2

numeric The degrees of freedom of the estimate.

method

character The method used to estimate correlation, which selects the symbol used for the value.

conf.level

numeric critical P-value expressed as fraction in [0..1].

range.brackets, range.sep

character Strings used to format a range.

See Also

sprintf_dm

Examples

Run this code
plain_label(value = 123, value.name = "n", output.type = "expression")
plain_label(value = 123, value.name = "n", output.type = "markdown")
plain_label(value = 123, value.name = "n", output.type = "latex")
italic_label(value = 123, value.name = "n", output.type = "expression")
italic_label(value = 123, value.name = "n", output.type = "markdown")
italic_label(value = 123, value.name = "n", output.type = "latex")
bold_label(value = 123, value.name = "n", output.type = "expression")
bold_label(value = 123, value.name = "n", output.type = "markdown")
bold_label(value = 123, value.name = "n", output.type = "latex")

p_value_label(value = 0.345, digits = 2, output.type = "expression")
p_value_label(value = 0.345, digits = Inf, output.type = "expression")
p_value_label(value = 0.345, digits = 6, output.type = "expression")
p_value_label(value = 0.345, output.type = "markdown")
p_value_label(value = 0.345, output.type = "latex")
p_value_label(value = 0.345, subscript = "Holm")
p_value_label(value = 1e-25, digits = Inf, output.type = "expression")

f_value_label(value = 123.4567, digits = 2, output.type = "expression")
f_value_label(value = 123.4567, digits = Inf, output.type = "expression")
f_value_label(value = 123.4567, digits = 6, output.type = "expression")
f_value_label(value = 123.4567, output.type = "markdown")
f_value_label(value = 123.4567, output.type = "latex")
f_value_label(value = 123.4567, df1 = 3, df2 = 123,
              digits = 2, output.type = "expression")
f_value_label(value = 123.4567, df1 = 3, df2 = 123,
              digits = 2, output.type = "latex")

t_value_label(value = 123.4567, digits = 2, output.type = "expression")
t_value_label(value = 123.4567, digits = Inf, output.type = "expression")
t_value_label(value = 123.4567, digits = 6, output.type = "expression")
t_value_label(value = 123.4567, output.type = "markdown")
t_value_label(value = 123.4567, output.type = "latex")
t_value_label(value = 123.4567, df = 12,
              digits = 2, output.type = "expression")
t_value_label(value = 123.4567, df = 123,
              digits = 2, output.type = "latex")

r_label(value = 0.95, digits = 2, output.type = "expression")
r_label(value = -0.95, digits = 2, output.type = "expression")
r_label(value = 0.0001, digits = 2, output.type = "expression")
r_label(value = -0.0001, digits = 2, output.type = "expression")
r_label(value = 0.1234567890, digits = Inf, output.type = "expression")
r_label(value = 0.95, digits = 2, method = "pearson")
r_label(value = 0.95, digits = 2, method = "kendall")
r_label(value = 0.95, digits = 2, method = "spearman")

rr_label(value = 0.95, digits = 2, output.type = "expression")
rr_label(value = 0.0001, digits = 2, output.type = "expression")
rr_label(value = 1e-17, digits = Inf, output.type = "expression")

adj_rr_label(value = 0.95, digits = 2, output.type = "expression")
adj_rr_label(value = 0.0001, digits = 2, output.type = "expression")

rr_ci_label(value = c(0.3, 0.4), conf.level = 0.95)
rr_ci_label(value = c(0.3, 0.4), conf.level = 0.95, output.type = "text")
rr_ci_label(value = c(0.3, 0.4), conf.level = 0.95, range.sep = ",")

r_ci_label(value = c(-0.3, 0.4), conf.level = 0.95)
r_ci_label(value = c(-0.3, 0.4), conf.level = 0.95, output.type = "text")
r_ci_label(value = c(-0.3, 0.4), conf.level = 0.95, range.sep = ",")
r_ci_label(value = c(-1.0, 0.4), conf.level = 0.95, range.sep = ",")

Run the code above in your browser using DataLab