In R, I'm wanting to create a graph with x axis label expression(varname)
, where varname
is a character object. For example:
varname <- "beta[1]"
hist(rnorm(20),xlab=expression(varname))
But that gives me a graph with xlab="varname"
rather than xlab=expression(beta[1])
. How to I convince expression()
to evaluate the variable?