Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 R 中,我想在带有 Spearman rho 结果的情节中包含一个图例。我用这个:
expression(paste(rho, " = ", cor(v$V1, v$V2, method = 'spearman')))
但在传说中我得到:
p = cor($(v,V1), $(v,V2), spearman)
我怎样才能得到cor的结果?
这是一个应该有帮助的例子:
set.seed(42) x <- 1:10 y <- rnorm(10) plot(x,y) text(7,1, bquote(rho==.(cor(x,y, method="spearman"))))
?bquote解释说它将评估.(). 您通常不需要使用pastewithin plotmath。
?bquote
.()
paste
plotmath