Add_R2: Adding R2 value for a linear regression

View source: R/ggthemes.R

Add_R2R Documentation

Adding R2 value for a linear regression

Description

Adding R2 value for a linear regression

Usage

Add_R2(
  method = "lm",
  formula = y ~ x,
  add_line = T,
  color,
  lty = "dashed",
  conf_int = F,
  ...
)

Arguments

method

model type

formula

model formula

add_line

Should we add a geom_smooth to the plot?

color

color of the geom_smooth

lty

linetype of the geom_smooth

conf_int

Should we display confindence intervals of the geom_smooth?

...

Other arguments passed to stat_poly_eq

Details

This is a dummy workaround of the original stat_poly_eq

Examples

## Not run: 
library(ggpubr)

ggplot(mtcars, aes(wt, mpg)) +
    geom_point() +
    labs(title = "A Lovely Plot",
         subtitle = "What can the subtitle tell us?") +
         Add_R2() +
    theme_clean()

## End(Not run)


atsyplenkov/atslib documentation built on April 21, 2024, 11:59 p.m.