myfun <- function(x){
plot(x = 1, y = 1, main = expression(paste(delta, "title ", x)))
}
myfun(3)
I'm using paste to pass in the x variable for my plot title. However, because I also have a mathematical symbol, delta, in the mix, I'm using expression on top of paste. However, this causes the variable x to not appear in the plot title.
Edit:
plot(x = 1, y = 1, main = bquote(paste(delta, "title ", .(x)))) solves the problem!
However, the same approach did not work for boxplot(x = 1, y = 1, main = bquote(paste(delta, "title ", .(x)))).
bquoteand wrap in.( )like this:plot(x = 1, y = 1, main = bquote(paste(delta, "title ", .(x))))... see this answer...or this one...boxplotinstead ofplot? I've edited the question.boxplot(...)(no main), then addtitle(bquote(...)).boxplot(1, 1, main = bquote(expression(paste(delta, " title ", .(x)))))