簡體   English   中英

在 R 的 ggscatter 中,我可以使用“,”而不是“。”嗎? 關於 r 和 p 值?

[英]In ggscatter in R, can I use "," instead the "." on the r and p-value?

我正在將ggscatter用於相關圖形。 它有效,de Pearson 相關性 (r) 正確。 但是,我是巴西人,小數點是由“,”而不是“.”定義的。

示例:r = 0,81 而不是英文形式 r = 0.81

我可以編輯這個嗎?

正如幾天前問的這個問題: Error in parse(text...) unexpected comma "," when plotting ggplot with ggpubr::stat_cor and output decimal set to comma (options(OutDec = ","))你可以使用一種解決方法,即通過將 output 十進制選項設置為逗號並將系數的 output 類型設置為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 上也有此問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM