as_plotmath.spar {spork}R Documentation

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 class 'spar'
as_plotmath(
  x,
  unrecognized = getOption("plotmath_unrecognized", spork::plotmathToken),
  ...
)

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.

Value

character

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.greek(), as_plotmath.spork(), as_plotmath(), concatenate.plotmath(), ggplot.plotmath(), goodToken(), plotmathToken()

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

Examples

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

[Package spork version 0.3.3 Index]