-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.Rmd
134 lines (97 loc) · 3.06 KB
/
README.Rmd
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
output: github_document
---
![](https://images.unsplash.com/photo-1572291720677-d8d28ac52a5b?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1556&q=80)
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
warning = F,
message = F
)
```
# ggxmean
<!-- badges: start -->
<!-- badges: end -->
The goal of ggxmean is plot the mean of x - and some other things like y!
## Installation
The development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("EvaMaeRey/ggxmean")
```
- [In-progress long form rationale and package exploration](https://evamaerey.github.io/ggxmean/manuscript.pdf)
- [Talk MAA Metro NY](https://evamaerey.github.io/ggxmean/talk_maa_metro_ny.html)
## Examples
<img src="https://github.com/EvaMaeRey/ggxmean/blob/master/docs/flipbook_preview.gif?raw=true" width="100%" />
<a href="https://evamaerey.github.io/ggxmean/flipbook.html" target="_blank">Open flipbook in a new tab</a>
```{r, eval = F, echo = F}
file.copy("inst/rmarkdown/templates/template-name/skeleton/skeleton.Rmd",
"docs/flipbook.Rmd", overwrite = T)
# Dont use, path's aren't relative. xaringanBuilder::build_html("docs/flipbook.Rmd")
xaringanBuilder::build_gif("docs/flipbook_preview.html", fps = 4)
knitr::opts_chunk$set(echo = F, eval = F)
```
```{r example}
# knitr::opts_chunk$set(eval = F)
options(gganimate.nframes = 60)
library(tidyverse)
library(ggxmean)
#library(transformr) might help w/ animate
## basic example code
cars %>%
ggplot() +
aes(x = speed,
y = dist) +
geom_point() +
ggxmean::geom_x_mean() +
ggxmean::geom_x_mean_label() +
ggxmean::geom_y_mean() +
ggxmean::geom_xy_means(color = "red",
size = 5) +
ggxmean::geom_lm_fitted(color = "goldenrod3",
size = 3) +
ggxmean::geom_lm_pred_int() +
ggxmean::geom_lm() +
ggxmean::geom_lm_residuals(linetype = "dashed") +
ggxmean::geom_lm_conf_int() +
ggxmean::geom_lm_formula()
```
---
```{r}
palmerpenguins::penguins %>%
ggplot() +
aes(x = bill_length_mm) +
geom_rug(alpha = .3) +
geom_histogram(alpha = .4) +
geom_x_mean() +
aes(fill = species) + # unexpected behavior here
aes(color = species) +
facet_wrap(facets = vars(species)) +
gganimate::transition_layers()
```
```{r}
library(ggxmean)
palmerpenguins::penguins %>%
drop_na() %>%
ggplot() +
aes(x = bill_length_mm) +
aes(y = flipper_length_mm) +
geom_point() +
ggxmean:::geom_x_mean() +
ggxmean:::geom_y_mean() +
ggxmean:::geom_y_line(alpha = .2) +
ggxmean:::geom_x_line(alpha = .2) +
ggxmean:::geom_xdiff() +
ggxmean:::geom_ydiff() +
ggxmean:::geom_x1sd(linetype = "dashed") +
ggxmean:::geom_y1sd(linetype = "dashed") +
ggxmean:::geom_diffsmultiplied() +
ggxmean:::geom_xydiffsmean(alpha = 1) +
ggxmean:::geom_rsq1() +
ggxmean:::geom_corrlabel() +
gganimate::transition_layers()
```