Reputation: 280
I am trying to make a label in a base R plot legend that has a greater than or equal to sign followed by a numeric value that is gathered from a variable. I can do this with the following code using the Unicode character, and the bquote
function:
data = c(1,2,3,4)
paste0("\u2265", bquote(.(data[2])))
I would like to know if it is possible to make such a label without the Unicode character, while referencing a variable for a numeric value. I have been unsuccessful using combinations of nested expression
, paste
, substitute
, and bquote
function calls, and I have not seen a question here that addresses this specific issue (I apologize if I missed something).
Ideally, the solution would generalize to other plotmath characters as well.
Upvotes: 0
Views: 409
Reputation: 132706
data = c(1,2,3,4)
plot.new()
text(0.5, 0.5, bquote({} >= .(data[2])), cex = 30)
Upvotes: 1