I would like to match a sequence of integers with a sequence of expression literals so that I can use them as label labels in a graphic, for example
lbls <- lapply(-2:2, function(i) expression(i * pi))
plot(...)
axis(1, at=seq(-2,2)*pi, labels=lbls)
So far, I've tried all the options bquote, substitute, expressionand so on, that I could think of, but apparently, I must have missed something. In addition, answers to frequently asked questions and related questions and answers did not fully resolve this for me.
How will I do it correctly (I want it to axisdisplay pias a Greek letter and have -2... 2replaced with iin the above example)?
source
share