How to portray the # symbol in R?

29 Views Asked by At

Is there a way to display # as a math symbol in R? Right now I have a figure legend

partition.legend <- c(
  'full' = 'Full',  
  'e0' = expression(Delta^0), 
  'el' = expression(Delta^lambda), 
  'ea' = expression(Delta^alpha),
  'eint' = expression(Delta^{alpha\*lambda}),
  'storage' = expression(Delta^(alpha\*lambda)), 
  'nocov' = expression(Delta^{alpha!=lambda})
)

For consistency with previous work it would be better to have # instead of != , but I can't find an expression for this.

I tried \# but that didn't work. I also looked at the different plotmath() options but am not seeing it listed.

1

There are 1 best solutions below

0
user2554330 On BEST ANSWER

Just put it in quotes. For example,

plot(1, main=expression(Delta^{paste(alpha, "#", lambda)}))

Created on 2024-03-13 with reprex v2.1.0