Learn R Programming

spork (version 0.3.5)

as_plotmath.spar: Convert One Spork to Plotmath

Description

Converts one spork to plotmath. See description for as_spork. Unrecognized tokens are returned unmodified by default. Otherwise, backslashes and single quotes are escaped, and the result is wrapped in single quotes. See plotmathToken.

Usage

# S3 method for spar
as_plotmath(
  x,
  unrecognized = getOption("plotmath_unrecognized", spork::plotmathToken),
  ...
)

Value

character

Arguments

x

spar

unrecognized

function to process unrecognized tokens

...

passed to unrecognized

Details

Experimental support is implemented for the sequence "backslash n" ('\n'). It tries to break the expression at the point indicated, and stack the results. Active subscripts and superscripts are closed in advance, preventing these from breaking across lines.

See Also

plotmathToken

Other interface: as.expression.plotmath(), as_html.spar(), as_html.spork(), as_latex.spar(), as_latex.spork(), as_plotmath.spork(), as_previews.spork(), as_spork.character(), htmlToken(), latexToken(), plotmathToken()

Other plotmath: [.plotmath(), [[.plotmath(), as.expression.plotmath(), as.png.plotmath(), as_plotmath(), as_plotmath.greek(), as_plotmath.spork(), concatenate.plotmath(), ggplot.plotmath(), goodToken(), plotmathToken()

Other spar: as_spar(), as_spar.default(), as_spar.spork()

Examples

Run this code
library(magrittr)
'V_c./F' %>% as_spork %>% as_plotmath
'AUC_ss' %>% as_spork %>% as_plotmath
'C_max_ss' %>% as_spork %>% as_plotmath
'var^eta_j' %>% as_spork %>% as_plotmath
'& % $ # \\_ { } ~ \\^ \\' %>% as_spork %>% as_plotmath
'one joule (Omega) ~ 1 kg*m^2./s^2' %>% as_spork %>% as_plotmath
'one joule (`Omega`) ~ 1 kg*m^2./s^2' %>% as_spork %>% as_plotmath
'one joule (\\`Omega\\`) ~ 1 kg*m^2./s^2' %>% as_spork %>% as_plotmath

Run the code above in your browser using DataLab