ToScientific | R Documentation |
Format numbers in scientific notation m x 10^n.
ToScientific( x, digits = NULL, type = c("latex", "plotmath"), na = as.character(NA), zero = "0", delimiter = "$", scipen = NULL, big.mark = ",", ... )
x |
'numeric' vector. Numbers |
digits |
'integer' count. Desired number of digits after the decimal point. |
type |
'character' string.
Specify |
na |
'character' string.
Value to use for missing values ( |
zero |
'character' string.
Value to use for zero values.
Specify as |
delimiter |
'character' string.
Delimiter for LaTeX mathematical mode, inline ( |
scipen |
'integer' count.
Penalty to be applied when deciding to format numeric values in scientific or fixed notation.
Positive values bias towards fixed and negative towards scientific notation:
fixed notation will be preferred unless it is more than |
big.mark |
'character' string. Mark inserted between every big interval before the decimal point. By default, commas are placed every 3 decimal places for numbers larger than 999. |
... |
Not used |
When type = "latex"
returns a 'character' vector of the same length as argument x
.
And when type = "plotmath"
returns a 'expression' vector of the same length as x
.
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
x <- c(-1e+09, 0, NA, pi * 10^(-5:5)) ToScientific(x, digits = 2, na = "---") ToScientific(x, digits = 2, scipen = 0) x <- seq(0, 20000, by = 4000) ToScientific(x, scipen = 0) lab <- ToScientific(x, type = "plotmath", scipen = 0) i <- seq_along(x) plot(i, type = "n", xaxt = "n", yaxt = "n", ann = FALSE) axis(1, i, labels = lab) axis(2, i, labels = lab)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.