Created
December 6, 2018 09:32
-
-
Save cecilesauder/a2909f7ae0507d533257b230fc83b0fc to your computer and use it in GitHub Desktop.
Est ce que y a une option pour que Mojito récupère Species et Gender de df2 , sans que je join que par Name parce que j'ai des animaux qui ont le même nom c'est relou
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` r | |
library(tidyverse) | |
df1 <- tibble(Name = c("Pastis", "Mojito", "Binouze"), | |
Species = c("CAT", NA, "DOG")) | |
df2 <- tibble(Name = c("Pastis", "Mojito", "Binouze", "Jack"), | |
Species = c("CAT", "CAT", "DOG", "DOG"), | |
Gender = c("M", "M", "F", "M")) | |
left_join(df1,df2) | |
#> Joining, by = c("Name", "Species") | |
#> # A tibble: 3 x 3 | |
#> Name Species Gender | |
#> <chr> <chr> <chr> | |
#> 1 Pastis CAT M | |
#> 2 Mojito <NA> <NA> | |
#> 3 Binouze DOG F | |
``` | |
<sup>Created on 2018-12-06 by the [reprex package](https://reprex.tidyverse.org) (v0.2.1)</sup> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment