In R, I want to include a legend in a plot with the result of the Spearman's rho. I use this:
expression(paste(rho, " = ", cor(v$V1, v$V2, method = 'spearman')))
But in the legend I get:
p = cor($(v,V1), $(v,V2), spearman)
How can I get the result of cor?
Here's an example that should help:
?bquote
explains that it'll evaluate calls within.()
. You generally don't need to usepaste
withinplotmath
.