R: how to construct a mathematical expression from a character object?
Posted
by Rob Hyndman
on Stack Overflow
See other posts from Stack Overflow
or by Rob Hyndman
Published on 2010-06-10T04:14:16Z
Indexed on
2010/06/10
4:22 UTC
Read the original article
Hit count: 195
r
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?
© Stack Overflow or respective owner