I am getting an error when I try and combine using expression
with do.call
and plot
.
x <- 1:10
y <- x^1.5
You can use alist
rather then list
p <- alist(xlab=expression(paste("Concentration (",mu,"M)")))
do.call(plot,c(y~x,p))
Setting quote=TRUE
also works. It in effect prevents do.call()
from evaluating the elements of args
before it passes them to the function given by what
.
x <- 1:10
y <- x^1.5
p <- list(xlab=expression(paste("Concentration (",mu,"M)",sep="")))
do.call(what = "plot", args = c(y ~ x, p), quote = TRUE)
do.call
evaluates the parameters before running the function; try wrapping the expression in quote
:
p <- list(xlab=quote(expression(paste("Concentration (",mu,"M)"))))
do.call("plot", c(y~x, p))