Description Usage Arguments Examples
View source: R/r_geom_lm_sample.R
A geom that shows a sampling of points
1 2 3 4 5 6 7 8 9 |
... |
all the geom_point arguments |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # without the function
library(magrittr)
library(dplyr)
set.seed(1214)
cars %>%
slice_sample( n = 10) ->
cars_sample
library(ggplot2)
ggplot(data = cars) +
aes(x = speed, y = dist) +
geom_point() +
geom_point(data = cars_sample,
color = "magenta") +
geom_smooth(method = lm, se = F,
data = cars_sample)
# the proto and function
"StatSamplepoint"
r_geom_lm_sample
# using the function
my_seed <- sample(1:100, 1)
ggplot(data = cars) +
aes(x = speed, y = dist) +
geom_point() +
geom_smooth(method = lm, se = F) +
q_geom_point_sample(color = "red", seed = my_seed) +
r_geom_lm_sample(color = "red", seed = my_seed)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.