Answer by AlexB for How do I display a correlation coefficient in a scatterplot?
Another way:round(cor(height, salary, method = c("pearson")), 4) -> corrand then using geom_text to display the correlation coefficient:r + geom_smooth(method = lm, formula = y ~ x, se = FALSE) +...
View ArticleAnswer by jay.sf for How do I display a correlation coefficient in a...
Here a base R way. Define a formula fo, calculate regression, and define an eqation.corr <- cor(height, salary, method = c("pearson"))fo <- salary ~ heightfit <- lm(fo, fakenumbers)(eq <-...
View ArticleAnswer by TarJae for How do I display a correlation coefficient in a...
We could do it with ggpubr package, adding stat_cor(p.accuracy = 0.001, r.accuracy = 0.01) to your code:library(ggpubr)library(tidyverse)r <- ggplot(fakenumbers, aes(x = height, y = salary)) +...
View ArticleHow do I display a correlation coefficient in a scatterplot?
In a scatterplot, I would like to display both the correlation coefficient along an equation describing the relationship between x and y.I have created my datamaterial, here is my code so...
View Article
More Pages to Explore .....