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))))
.