I have encountered difficulty trying to display multiple inequality symbols in a text box placed on a plot window in R. Using a single inequality is acceptable, such as mtext(expression("a">="b"))
. However, using three inequalities, such as mtext(expression("a">="b and c"<"d"<="e"))
leads to halting of execution by the interpreter, which complains that the second inequality symbol is unexpected. How can multiple inequalities be used within a single text box?
The five inequality symbols in Maths are greater than symbol (>), less than symbol (<), greater than or equal to symbol (≥), less than or equal to symbol (≤), and not equal to symbol (≠).
The Less Than or Equal To, and Greater Than or Equal To Operators <= and >= We can also check to see if one R object is greater than or equal to (or less than or equal to) another R object. To do this, we can use the less than sign, or the greater than sign, together with the equals sign.
You can also do this by mixing plotmath
symbol and paste
:
mtext(expression(a>b ~and ~paste(c < d) <= e))
You can use phantom()
for a non-visible symbol:
plot(1)
mtext(expression(a >= b ~ and ~ c < d ~ phantom() <= e))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With