pretty_sci | R Documentation |
Functions to parse numeric vectors in scientific notation and return an
expression
for a pretty display.
pretty_sci(x, digits = 0L, base = 10, limit = base^3, simplify = TRUE)
oom(x, base = 10)
parse_sci(x, digits = 0L, base = 10, simplify = TRUE)
x |
a numeric vector |
digits |
integer indicating the number of decimal places to be used |
base |
a positive or complex number: the base with respect to which logarithms are computed (default is 10) |
limit |
a numeric value whose order of magnitude will set a limit
beyond which values of |
simplify |
logical; if |
For oom
an integer vector of magnitudes. For parse_sci
an
expression of values in scientific notation. For pretty_sci
an
expression of values in standard or scientific notation or combination
depending on the value of limit
.
pretty10exp
; roundr
;
format
; sprintf
x <- 10 ^ (1:5) / 10
oom(x)
oom(1 / x)
parse_sci(x)
parse_sci(x, simplify = FALSE)
parse_sci(x, base = 100)
parse_sci(1.1 * 2 ^ (1:5), 1, 2)
par(xpd = NA, mar = c(6,4,4,2) + .1)
plot(1:5, type = 'n', axes = FALSE, ann = FALSE)
axis(2, at = 1:5, labels = pretty_sci(x, simplify = FALSE), las = 1)
text(1:5, 0, pretty_sci(1 / x ^ 10))
text(1:5, 1, pretty_sci(1 / x, digits = 3))
text(1:5, 2, pretty_sci(1 / x, digits = 2, limit = 1e2))
text(1:5, 3, x)
text(1:5, 4, pretty_sci(x, limit = 1e2))
text(1:5, 5, pretty_sci(x, digits = 1))
text(1:5, 6, pretty_sci(x ^ 10))
text(1:5, -1, pretty_sci(1 / x, limit = -1, simplify = FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.