瀏覽代碼

Add text from ?dplyr::join

pull/5/merge
Garrick Aden-Buie 7 年之前
父節點
當前提交
1f313fff4d
共有 2 個檔案被更改,包括 39 行新增4 行删除
  1. +16
    -2
      README.Rmd
  2. +23
    -2
      README.md

+ 16
- 2
README.Rmd 查看文件

@@ -23,7 +23,7 @@ Garrick Aden-Buie -- [@grrrck](https://twitter.com/grrrck) -- [garrickade

[![Binder](http://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/gadenbuie/tidy-animated-verbs/master?urlpath=rstudio)

- Mutate Joins: [`inner_join()`](#inner-join), [`left_join()`](#left-join),
- Mutating Joins: [`inner_join()`](#inner-join), [`left_join()`](#left-join),
[`right_join()`](#right-join), [`full_join()`](#full-join)
- Filtering Joins: [`semi_join()`](#semi-join), [`anti_join()`](#anti-join)
@@ -32,7 +32,7 @@ Garrick Aden-Buie -- [@grrrck](https://twitter.com/grrrck) -- [garrickade
- [Relational Data](#relational-data)
- [gganimate](#gganimate)

## Mutate Joins
## Mutating Joins

```{r intial-dfs}
source("R/00_base.R")
@@ -58,6 +58,8 @@ y

### Inner Join

> All rows from `x` where there are matching values in `y`, and all columns from `x` and `y`.

```{r inner-join}
source("R/inner_join.R")
```
@@ -70,6 +72,8 @@ inner_join(x, y, by = "id")

### Left Join

> 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}
source("R/left_join.R")
```
@@ -82,6 +86,8 @@ left_join(x, y, by = "id")

### Left Join (Extra Rows in y)

> ... If there are multiple matches between `x` and `y`, all combinations of the matches are returned.

```{r left-join-extra}
source("R/left_join_extra.R")
```
@@ -95,6 +101,8 @@ left_join(x, y_extra, by = "id")

### Right Join

> 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}
source("R/right_join.R")
```
@@ -107,6 +115,8 @@ right_join(x, y, by = "id")

### Full Join

> 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}
source("R/full_join.R")
```
@@ -121,6 +131,8 @@ full_join(x, y, by = "id")

### Semi Join

> All rows from `x` where there are matching values in `y`, keeping just columns from `x`.

```{r semi-join}
source("R/semi_join.R")
```
@@ -133,6 +145,8 @@ semi_join(x, y, by = "id")

### Anti Join

> All rows from `x` where there are not matching values in `y`, keeping just columns from `x`.

```{r anti-join}
source("R/anti_join.R")
```

+ 23
- 2
README.md 查看文件

@@ -8,7 +8,7 @@ Garrick Aden-Buie – [@grrrck](https://twitter.com/grrrck) –

[![Binder](http://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/gadenbuie/tidy-animated-verbs/master?urlpath=rstudio)

- Mutate Joins: [`inner_join()`](#inner-join),
- Mutating Joins: [`inner_join()`](#inner-join),
[`left_join()`](#left-join), [`right_join()`](#right-join),
[`full_join()`](#full-join)

@@ -20,7 +20,7 @@ Garrick Aden-Buie – [@grrrck](https://twitter.com/grrrck) –
- [Relational Data](#relational-data)
- [gganimate](#gganimate)

## Mutate Joins
## Mutating Joins

<img src="images/original-dfs.png" width="480px" />

@@ -43,6 +43,9 @@ y

### Inner Join

> All rows from `x` where there are matching values in `y`, and all
> columns from `x` and `y`.

![](images/inner-join.gif)

``` r
@@ -56,6 +59,9 @@ inner_join(x, y, by = "id")

### Left Join

> 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.

![](images/left-join.gif)

``` r
@@ -70,6 +76,9 @@ left_join(x, y, by = "id")

### Left Join (Extra Rows in y)

> … If there are multiple matches between `x` and `y`, all combinations
> of the matches are returned.

![](images/left-join-extra.gif)

``` r
@@ -93,6 +102,9 @@ left_join(x, y_extra, by = "id")

### Right Join

> 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.

![](images/right-join.gif)

``` r
@@ -107,6 +119,9 @@ right_join(x, y, by = "id")

### Full Join

> All rows and all columns from both `x` and `y`. Where there are not
> matching values, returns `NA` for the one missing.

![](images/full-join.gif)

``` r
@@ -124,6 +139,9 @@ full_join(x, y, by = "id")

### Semi Join

> All rows from `x` where there are matching values in `y`, keeping just
> columns from `x`.

![](images/semi-join.gif)

``` r
@@ -137,6 +155,9 @@ semi_join(x, y, by = "id")

### Anti Join

> All rows from `x` where there are not matching values in `y`, keeping
> just columns from `x`.

![](images/anti-join.gif)

``` r

Loading…
取消
儲存