| as_spork | R Documentation |
Coerces to class 'spork'. Generic,
with method as_spork.character.
A spork is simple text expressing
arbitrarily nested subscripts (x_y_z)
and superscripts (x^y^z). A dot
(x^y._z) explicitly terminates
a group. An asterisk (*) suggests
multiplication; a literal backslash
followed by 'n' suggests a newline
(handling differs for latex vs. plotmath).
Special characters may be escaped with a backslash.
Convert to plotmath with as_plotmath
and to latex with as_latex
and to html with as_html.
Both plotmath and latex names of Greek
letters are supported; see as_previews.spork
and examples there for disambiguation.
as_spork(x, ...)
x |
object |
... |
passed arguments |
spork
Other spork:
[.spork(),
[[.spork(),
as.list.spork(),
as.png.spork(),
as_html.spork(),
as_latex.spork(),
as_plotmath.spork(),
as_previews.spork(),
as_spar.default(),
as_spar.spork(),
as_spork.character(),
as_spork.factor(),
as_spork.spork(),
ggplot.spork(),
greek()
library(ggplot2)
label <- 'one joule (Omega) ~ 1 kg*m^2./s^2'
label <- as_spork(label)
label <- as_plotmath(label)
label <- as.expression(label)
x <- data.frame(y=1:10, x=1:10)
p <- ggplot(x, aes(x, y))
p$labels$x <- label
print(p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.