Sets figure output to man/figures/tidyexplain- and ensures that all R chunks that output figures are named. This gives a collection of animations and static images with reasonable names ready for download and use.pull/18/merge
| @@ -1,6 +1,6 @@ | |||
| Type: Package | |||
| Package: tidyverbs | |||
| Title: Animate the Verbs of the Tidyverse | |||
| Package: tidyexplain | |||
| Title: Animated Explanations of Tidyverse Verbs | |||
| Version: 0.0.1.9000 | |||
| Date: 2018-08-27 | |||
| Authors@R: | |||
| @@ -15,7 +15,8 @@ Authors@R: | |||
| person(given = "Tyler Grant", | |||
| family = "Smith", | |||
| role = "ctb")) | |||
| Description: Animate the verbs of the tidyverse. | |||
| Description: Animated explanations of the verbs in the tidyverse | |||
| using gganimate and ggplot2. | |||
| License: MIT + file LICENSE | |||
| Depends: | |||
| gganimate (>= 0.9.9.9999), | |||
| @@ -29,8 +30,8 @@ Imports: | |||
| Suggests: | |||
| knitr, | |||
| roxygen2, | |||
| viridis, | |||
| testthat | |||
| testthat, | |||
| viridis | |||
| VignetteBuilder: | |||
| knitr | |||
| Encoding: UTF-8 | |||
| @@ -1,5 +1,7 @@ | |||
| --- | |||
| output: github_document | |||
| editor_options: | |||
| chunk_output_type: console | |||
| --- | |||
| <!-- README.md is generated from README.Rmd. Please edit that file --> | |||
| @@ -11,9 +13,12 @@ knitr::opts_chunk$set( | |||
| echo = TRUE, | |||
| warning = FALSE, | |||
| message = FALSE, | |||
| fig.path = "man/figures/tidyexplain-", | |||
| cache = TRUE | |||
| ) | |||
| library(tidyAnimatedVerbs) | |||
| library(dplyr) | |||
| library(tidyexplain) | |||
| set_font_size(11, 26) | |||
| ``` | |||
| [gganimate]: https://github.com/thomasp85/gganimate#README | |||
| @@ -38,8 +43,8 @@ Garrick Aden-Buie -- [@grrrck](https://twitter.com/grrrck) -- [garrickade | |||
| - Tidyr Operations: [`gather()`](#gather), [`spread()`](#spread) | |||
| - Learn more about | |||
| - [Relational Data](#relational-data) | |||
| - [gganimate](#gganimate) | |||
| - [Relational Data](#relational-data) | |||
| - [gganimate](#gganimate) | |||
| Please feel free to use these images for teaching or learning about action verbs from the [tidyverse](https://tidyverse.org). | |||
| @@ -50,16 +55,18 @@ Currently, the animations cover the [dplyr two-table verbs][dplyr-two-table] and | |||
| ## Installing | |||
| The library can be installed with | |||
| ```{r, echo=T,eval=F} | |||
| The in-development version of `tidyexplain` can be installed with `devtools`: | |||
| ```r | |||
| # install.package("devtools") | |||
| devtools::install_github("gadenbuie/tidy-animated-verbs") | |||
| library(tidyexplain) | |||
| ``` | |||
| ## Mutating Joins | |||
| ```{r intial-dfs, echo=T} | |||
| library(tidyAnimatedVerbs) | |||
| ```{r intial-dfs} | |||
| x <- data_frame( | |||
| id = 1:3, | |||
| x = paste0("x", 1:3) | |||
| @@ -74,7 +81,7 @@ animate_full_join(x, y, by = c("id"), export = "first") | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| x | |||
| y | |||
| ``` | |||
| @@ -83,12 +90,12 @@ y | |||
| > All rows from `x` where there are matching values in `y`, and all columns from `x` and `y`. | |||
| ```{r inner-join, echo=T} | |||
| ```{r inner-join} | |||
| animate_inner_join(x, y, by = "id") | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| inner_join(x, y, by = "id") | |||
| ``` | |||
| @@ -96,12 +103,12 @@ inner_join(x, y, by = "id") | |||
| > All rows from `x`, and all columns from `x` and `y`. Rows in `x` with no match in `y` will have `NA` values in the new columns. | |||
| ```{r left-join, echo=T} | |||
| ```{r left-join} | |||
| animate_left_join(x, y, by = "id") | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| left_join(x, y, by = "id") | |||
| ``` | |||
| @@ -109,14 +116,14 @@ left_join(x, y, by = "id") | |||
| > ... If there are multiple matches between `x` and `y`, all combinations of the matches are returned. | |||
| ```{r left-join-extra, echo=T} | |||
| ```{r left-join-extra} | |||
| y_extra <- bind_rows(y, data_frame(id = 2, y = "y5")) | |||
| y_extra # has multiple rows with the key from `x` | |||
| animate_left_join(x, y_extra, by = "id") | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| left_join(x, y_extra, by = "id") | |||
| ``` | |||
| @@ -124,12 +131,12 @@ left_join(x, y_extra, by = "id") | |||
| > All rows from y, and all columns from `x` and `y`. Rows in `y` with no match in `x` will have `NA` values in the new columns. | |||
| ```{r right-join, echo = T} | |||
| ```{r right-join} | |||
| animate_right_join(x, y, by = "id") | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| right_join(x, y, by = "id") | |||
| ``` | |||
| @@ -137,12 +144,12 @@ right_join(x, y, by = "id") | |||
| > All rows and all columns from both `x` and `y`. Where there are not matching values, returns `NA` for the one missing. | |||
| ```{r full-join, echo=T} | |||
| ```{r full-join} | |||
| animate_full_join(x, y, by = "id") | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| full_join(x, y, by = "id") | |||
| ``` | |||
| @@ -152,12 +159,12 @@ full_join(x, y, by = "id") | |||
| > All rows from `x` where there are matching values in `y`, keeping just columns from `x`. | |||
| ```{r semi-join, echo=T} | |||
| ```{r semi-join} | |||
| animate_semi_join(x, y, by = "id") | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| semi_join(x, y, by = "id") | |||
| ``` | |||
| @@ -165,18 +172,18 @@ semi_join(x, y, by = "id") | |||
| > All rows from `x` where there are not matching values in `y`, keeping just columns from `x`. | |||
| ```{r anti-join, echo=T} | |||
| ```{r anti-join} | |||
| animate_anti_join(x, y, by = "id") | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| anti_join(x, y, by = "id") | |||
| ``` | |||
| ## Set Operations | |||
| ```{r intial-dfs-so, echo=T} | |||
| ```{r intial-dfs-so} | |||
| x <- data_frame( | |||
| x = c(1, 1, 2), | |||
| y = c("a", "b", "a") | |||
| @@ -190,7 +197,7 @@ animate_union(x, y, export = "first") | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| x | |||
| y | |||
| ``` | |||
| @@ -199,18 +206,18 @@ y | |||
| > All unique rows from `x` and `y`. | |||
| ```{r union, echo=T} | |||
| ```{r union} | |||
| animate_union(x, y) | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| union(x, y) | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r union-y-x} | |||
| animate_union(y, x) | |||
| union(y, x) | |||
| @@ -220,13 +227,13 @@ union(y, x) | |||
| > All rows from `x` and `y`, keeping duplicates. | |||
| ```{r union-all, echo=T} | |||
| ```{r union-all} | |||
| animate_union_all(x, y) | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| union_all(x, y) | |||
| ``` | |||
| @@ -235,12 +242,12 @@ union_all(x, y) | |||
| > Common rows in both `x` and `y`, keeping just unique rows. | |||
| ```{r intersect, echo=T} | |||
| ```{r intersect} | |||
| animate_intersect(x, y) | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| intersect(x, y) | |||
| ``` | |||
| @@ -248,17 +255,17 @@ intersect(x, y) | |||
| > All rows from `x` which are not also rows in `y`, keeping just unique rows. | |||
| ```{r setdiff, echo=T} | |||
| ```{r setdiff} | |||
| animate_setdiff(x, y) | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r} | |||
| setdiff(x, y) | |||
| ``` | |||
| ```{r echo=TRUE} | |||
| ```{r setdiff-y-x} | |||
| animate_setdiff(y, x) | |||
| setdiff(y, x) | |||
| @@ -279,6 +286,8 @@ to be formatted as a tidy dataset and the | |||
| you organize your data into tidy data. | |||
| ```{r} | |||
| library(tidyr) | |||
| long <- data_frame( | |||
| year = c(2010, 2011, 2010, 2011, 2010, 2011), | |||
| person = c("Alice", "Alice", "Bob", "Bob", "Charlie", "Charlie"), | |||
| @@ -292,12 +301,11 @@ wide <- data_frame( | |||
| ) | |||
| ``` | |||
| ### Gather | |||
| > Gather takes multiple columns and collapses into key-value pairs, duplicating all other columns as needed. You use gather() when you notice that your column names are not names of variables, but values of a variable. | |||
| ```{r} | |||
| ```{r gather} | |||
| animate_gather(wide, key = "person", value = "sales", -year) | |||
| ``` | |||
| @@ -305,13 +313,11 @@ animate_gather(wide, key = "person", value = "sales", -year) | |||
| gather(wide, key = "person", value = "sales", -year) | |||
| ``` | |||
| ### Spread | |||
| > Spread a key-value pair across multiple columns. Use it when an a column contains observations from multiple variables. | |||
| ```{r} | |||
| ```{r spread} | |||
| animate_spread(long, key = "person", value = "sales") | |||
| ``` | |||
| @@ -320,9 +326,6 @@ spread(long, key = "person", value = "sales") | |||
| ``` | |||
| ## Learn More | |||
| ### Relational Data | |||
| @@ -25,10 +25,9 @@ Smith](https://github.com/TylerGrantSmith). | |||
| - Tidyr Operations: [`gather()`](#gather), [`spread()`](#spread) | |||
| - Learn more about | |||
| - [Relational Data](#relational-data) | |||
| - [gganimate](#gganimate) | |||
| - [Relational Data](#relational-data) | |||
| - [gganimate](#gganimate) | |||
| Please feel free to use these images for teaching or learning about | |||
| action verbs from the [tidyverse](https://tidyverse.org). You can | |||
| @@ -44,17 +43,19 @@ welcome\!](https://github.com/gadenbuie/tidy-animated-verbs/issues) | |||
| ## Installing | |||
| The library can be installed with | |||
| The in-development version of `tidyexplain` can be installed with | |||
| `devtools`: | |||
| ``` r | |||
| # install.package("devtools") | |||
| devtools::install_github("gadenbuie/tidy-animated-verbs") | |||
| library(tidyexplain) | |||
| ``` | |||
| ## Mutating Joins | |||
| ``` r | |||
| library(tidyAnimatedVerbs) | |||
| x <- data_frame( | |||
| id = 1:3, | |||
| x = paste0("x", 1:3) | |||
| @@ -68,7 +69,7 @@ y <- data_frame( | |||
| animate_full_join(x, y, by = c("id"), export = "first") | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| x | |||
| @@ -96,7 +97,7 @@ y | |||
| animate_inner_join(x, y, by = "id") | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| inner_join(x, y, by = "id") | |||
| @@ -116,7 +117,7 @@ inner_join(x, y, by = "id") | |||
| animate_left_join(x, y, by = "id") | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| left_join(x, y, by = "id") | |||
| @@ -147,7 +148,7 @@ y_extra # has multiple rows with the key from `x` | |||
| animate_left_join(x, y_extra, by = "id") | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| left_join(x, y_extra, by = "id") | |||
| @@ -169,7 +170,7 @@ left_join(x, y_extra, by = "id") | |||
| animate_right_join(x, y, by = "id") | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| right_join(x, y, by = "id") | |||
| @@ -190,7 +191,7 @@ right_join(x, y, by = "id") | |||
| animate_full_join(x, y, by = "id") | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| full_join(x, y, by = "id") | |||
| @@ -214,7 +215,7 @@ full_join(x, y, by = "id") | |||
| animate_semi_join(x, y, by = "id") | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| semi_join(x, y, by = "id") | |||
| @@ -234,7 +235,7 @@ semi_join(x, y, by = "id") | |||
| animate_anti_join(x, y, by = "id") | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| anti_join(x, y, by = "id") | |||
| @@ -259,7 +260,7 @@ y <- data_frame( | |||
| animate_union(x, y, export = "first") | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| x | |||
| @@ -285,7 +286,7 @@ y | |||
| animate_union(x, y) | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| union(x, y) | |||
| @@ -302,7 +303,7 @@ union(x, y) | |||
| animate_union(y, x) | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| @@ -324,7 +325,7 @@ union(y, x) | |||
| animate_union_all(x, y) | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| union_all(x, y) | |||
| @@ -346,7 +347,7 @@ union_all(x, y) | |||
| animate_intersect(x, y) | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| intersect(x, y) | |||
| @@ -365,7 +366,7 @@ intersect(x, y) | |||
| animate_setdiff(x, y) | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| setdiff(x, y) | |||
| @@ -380,7 +381,7 @@ setdiff(x, y) | |||
| animate_setdiff(y, x) | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| @@ -406,6 +407,8 @@ to be formatted as a tidy dataset and the | |||
| you organize your data into tidy data. | |||
| ``` r | |||
| library(tidyr) | |||
| long <- data_frame( | |||
| year = c(2010, 2011, 2010, 2011, 2010, 2011), | |||
| person = c("Alice", "Alice", "Bob", "Bob", "Charlie", "Charlie"), | |||
| @@ -430,7 +433,7 @@ wide <- data_frame( | |||
| animate_gather(wide, key = "person", value = "sales", -year) | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| gather(wide, key = "person", value = "sales", -year) | |||
| @@ -454,7 +457,7 @@ gather(wide, key = "person", value = "sales", -year) | |||
| animate_spread(long, key = "person", value = "sales") | |||
| ``` | |||
| <!-- --> | |||
| <!-- --> | |||
| ``` r | |||
| spread(long, key = "person", value = "sales") | |||
| @@ -1,12 +1,13 @@ | |||
| % Generated by roxygen2: do not edit by hand | |||
| % Please edit documentation in R/zzzz-package.R | |||
| \docType{package} | |||
| \name{tidyverbs-package} | |||
| \alias{tidyverbs} | |||
| \alias{tidyverbs-package} | |||
| \title{tidyverbs: Animate the Verbs of the Tidyverse} | |||
| \name{tidyexplain-package} | |||
| \alias{tidyexplain} | |||
| \alias{tidyexplain-package} | |||
| \title{tidyexplain: Animated Explanations of Tidyverse Verbs} | |||
| \description{ | |||
| Animate the verbs of the tidyverse. | |||
| Animated explanations of the verbs in the tidyverse | |||
| using gganimate and ggplot2. | |||
| } | |||
| \author{ | |||
| \strong{Maintainer}: Garrick Aden-Buie \email{g.adenbuie@gmail.com} | |||