Here's an example that should help:
set.seed(42)
x <- 1:10
y <- rnorm(10)
plot(x,y)
text(7,1, bquote(rho==.(cor(x,y, method="spearman"))))
?bquote
explains that it'll evaluate calls within .()
. You generally don't need to use paste
within plotmath
.