Make latex notation for best value and confidence boundaries.

latex_range_sci(
  best,
  min,
  max,
  ndigits = "auto",
  na = "-",
  symmetry = FALSE,
  base_pow = NULL
)

Arguments

best

best value

min

lower boundary value

max

upper boundary value

ndigits

'auto' (default) or number of digits after decimal point

na

show NA value as na. default na='-'

symmetry

if errors are symmetric show as value+/-err

base_pow

set to numeric if you want to make column with the same power.

Value

character

Examples


x <- c(NA, 1e21, 3e22, 1e23)
err <- c(NA, 0.1e21, 0.5e21, 0.1e23)
latex_range_sci(best = x, min = x - err, max = x + err, ndigits = 2)
#> Warning: Is argument `ndigits` too small?
#> [1] "$-$"                                  
#> [2] "$1.00_{-0.10}^{+0.10}~\\times10^{21}$"
#> [3] "$0.30_{-0.01}^{+0.00}~\\times10^{23}$"
#> [4] "$1.00_{-0.10}^{+0.10}~\\times10^{23}$"

latex_range_sci(x, x - err, x + err, ndigits = 2, na = '', symmetry = TRUE)
#> Warning: Is argument `ndigits` too small?
#> [1] "$$"                              "$(1.00\\pm0.10)~\\times10^{21}$"
#> [3] "$(0.30\\pm0.01)~\\times10^{23}$" "$(1.00\\pm0.10)~\\times10^{23}$"

latex_range_sci(x, x - err, x + err, ndigits = 2, base_pow=21)
#> [1] "$-$"                                      
#> [2] "$1.00_{-0.10}^{+0.10}~\\times10^{21}$"    
#> [3] "$30.00_{-0.50}^{+0.50}~\\times10^{21}$"   
#> [4] "$100.00_{-10.00}^{+10.00}~\\times10^{21}$"