HateSpinach
HateSpinach

Reputation: 21

How to include the expression and unicode in a label in R?

I don't find a way to show an expression and the "per-mille" symbol in the same label. I have tried the next four ways:

name1 <- paste(expression(delta^18*O),"(\u{2030})")
name2 <- "\u{1E9F}O18 (\u{2030})"
name3 <- expression(delta^18*O)
name4 <- expression(paste(delta^18*O,"(\u{2030})"))

All of them show errors,

enter image description here

Upvotes: 2

Views: 897

Answers (1)

Rui Barradas
Rui Barradas

Reputation: 76613

Is this it?

name3 <- expression(delta^18 * O * "(\u{2030})")
plot(1, xlab = name3)

Created on 2022-04-29 by the reprex package (v2.0.1)


For more space between elements, use tildes instead of asterisks.

name3 <- expression(delta^18 ~ O ~ "(\u{2030})")
name3 <- expression(delta^18 * O ~ "(\u{2030})")

Upvotes: 1

Related Questions