stat_smooth_func: stat_smooth_func

Description Usage Arguments Examples

View source: R/stat_smooth_func.R

Description

mostly taken from https://stackoverflow.com/questions/7549694/adding-regression-line-equation-and-r2-on-graph

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
stat_smooth_func(
  mapping = NULL,
  data = NULL,
  geom = "smooth",
  position = "identity",
  ...,
  method = "auto",
  formula = y ~ x,
  se = TRUE,
  n = 80,
  span = 0.75,
  fullrange = FALSE,
  level = 0.95,
  method.args = list(),
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,
  xpos = NULL,
  ypos = NULL
)

Arguments

mapping

mapping

data

data

geom

geom

position

pos

...

extra

method

method

formula

form

se

se

n

n

span

span

fullrange

full

level

lev

method.args

x

na.rm

na.rm

show.legend

y

inherit.aes

z

xpos

a

ypos

b

Examples

1
2
3
4
5
6
7
library(dplyr)
library(ggplot2)
iris %>%
  ggplot(aes(x = Sepal.Width, y = Petal.Width, color = Species)) +
  geom_point() +
  stat_smooth_func(geom = "text", method = "lm", parse = TRUE, hjust = 0) +
  facet_wrap(~Species)

eringrand/RUncommon documentation built on Sept. 22, 2020, 10:49 p.m.