0

I am using ggscatter for a correlation graphic. It works, with de Pearson correlation (r) correct. However, I am Brazilian, and the decimal point is defined by the "," instead of the ".".

Examples: r = 0,81 instead the English-form r = 0.81

Can I edit this?

Quinten
  • 35,235
  • 5
  • 20
  • 53
  • 2
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Nov 16 '22 at 17:55

1 Answers1

4

As asked a few days ago with this question: Error in parse(text ...) unexpected comma "," when plotting ggplot with ggpubr::stat_cor and output decimal set to comma (options(OutDec = ",")) You can use a workaround that is by setting the output decimal option to a comma and output type of the coefficients to text in output.type like this:

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'

Created on 2022-11-16 with reprex v2.0.2

There is also an issue on GitHub for this.

Quinten
  • 35,235
  • 5
  • 20
  • 53