Skip to contents

ion_labeller and R_labeller converts a character string containing chemical species names in a latex string or expression. The stat_labeller function generates labels for statistics in tables (latex) or on plots (expressions).

Usage

ion_labeller(ion, label = "latex")

R_labeller(ion1, ion2, label = "latex")

stat_labeller(var, org, stat, value, label = "latex")

Arguments

ion

A chemical species character string

label

Character string indicating whether the output should be "latex" or an expression ("expr").

ion1

A chemical species character string (for isotope ratios the rare isotope).

ion2

A chemical species character string (for isotope ratios the common isotope).

var

A character string for the variable, either "X" for single ions or "R" for ion ratios.

org

A character string for the origin of a derived variable, e.g., R.

stat

A character string for the statistic following convention of e.g. point::names_stat_X.

value

The numeric value for the statistic result.

Value

A character string parsable in Latex or expression for usage in plots.

Details

This functions converts chemical species names of the form, e.g. `"12C"`, `"13C2"`, `"12C 14N"`, or `"12C-14N"` to a character string which can be parsed in Latex to species names with appropriate superscripts on th left for mass and subscripts for the index on the right.

Examples

# plot some ion count data
library(ggplot2)
ggplot() +
 geom_blank() +
 ylab(ion_labeller("12C2-40Ca", "expr")) +
 xlab(R_labeller("12C2-40Ca", "13C2-40Ca", "expr"))