?plotmath
starts
If the text
argument to one of the text-drawing functions (text
,
mtext
, axis
, legend
) in R is an expression, the argument is
interpreted as a mathematical expression and the output will be
formatted according to TeX-like rules.
and the labels
parameter of text
is documented as
a character vector or expression specifying the text to be written. An
attempt is made to coerce other language objects (names and calls) to
expressions, and vectors and other classed objects to character
vectors by as.character
.
(emphasis mine). bquote
does not actually return an expression (the R class, not the concept), but a language object (a call, specifically). This is causing two problems:
- Because R can't handle a vector of calls,
c
does not actually create a vector, but instead coerces the result to a list, akin to how c(sum, mean)
is coerced to a list, and
- While
text
would coerce the call returned from bquote
itself to an expression (which would get parsed properly), it coerces the list to a character vector, which does not get interpreted according to plotmath
.
You could coerce the list of calls produced with c
and bquote
explicitly with as.expression
, but it's quicker to just call expression
directly and avoid bquote
altogether:
plot(1, ty ='n', ann = F, xlim = c(-4, 6), ylim = c(-3.5, 1.5))
text(c(-4, 6 ), rep(1, 2), expression(-infinity, infinity))

As an end note, c
actually does work on multiple expressions—sort of—in that c(expression(-infinity), expression(infinity))
returns expression(-infinity, infinity)
. Unlike bquote
, which has two named parameters, expression
takes ...
though, so it's easier to just call it once with multiple inputs.