我正在將 ggscatter 用于相關圖形。它有效,de Pearson 相關性 (r) 正確。但是,我是巴西人,小數點是由“,”而不是“.”定義的。
示例:r = 0,81 而不是英語形式的 r = 0.81
我可以編輯這個嗎?
uj5u.com熱心網友回復:
正如幾天前提出的這個問題:Error in parse(text ...) unexpected comma "," when plotting ggplot with ggpubr::stat_cor and output decimal set to comma (options(OutDec = ","))你可以使用一種變通方法,將輸出小數選項設定為逗號,并將系數的輸出型別設定為文本,output.type
如下所示:
library(ggpubr)
#> Loading required package: ggplot2
options(OutDec= ",")
ggscatter(mtcars, x = "wt", y = "mpg",
add = "reg.line",
cor.coef = TRUE,
cor.coeff.args = list(method = "pearson", output.type="text"))
#> `geom_smooth()` using formula = 'y ~ x'
創建于 2022-11-16,使用reprex v2.0.2
GitHub 上也有一個關于此的問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/535409.html
標籤:r小数点
上一篇:為每個觀察添加頻率列