1. Import your data

Import two related datasets from TidyTuesday Project.

survivalists <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2023/2023-01-24/survivalists.csv')
## Rows: 94 Columns: 16
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (10): name, gender, city, state, country, reason_tapped_out, reason_cate...
## dbl  (5): season, age, result, days_lasted, day_linked_up
## lgl  (1): medically_evacuated
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
loadouts <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2023/2023-01-24/loadouts.csv')
## Rows: 940 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): version, name, item_detailed, item
## dbl (2): season, item_number
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

2. Make data small

Describe the two datasets:

Data1 : Survivalist

Data 2

set.seed(1234)
survivalists_small <- survivalists %>% select(season,name,age) %>% sample_n(10) 
loadouts_small <- loadouts %>% select(season,name,item_detailed) %>% sample_n(10)

survivalists_small
## # A tibble: 10 × 3
##    season name                 age
##     <dbl> <chr>              <dbl>
##  1      3 Britt Ahart           40
##  2      8 Nate Weber            47
##  3      3 Carleigh Fairchild    28
##  4      1 Chris Weatherman      41
##  5      1 Dustin Feher          37
##  6      4 Brody Wilkes          33
##  7      2 Randy Champagne       28
##  8      1 Lucas Miller          32
##  9      9 Karie Lee Knoke       57
## 10      7 Joe Nicholas          31
loadouts_small
## # A tibble: 10 × 3
##    season name             item_detailed                                        
##     <dbl> <chr>            <chr>                                                
##  1      1 Chris Weatherman Knife                                                
##  2      9 Jessie Krebs     Trapping wire                                        
##  3      3 Jim Shields      Rations                                              
##  4      4 Shannon Bosdell  Tarp – 12′ x 12′                                     
##  5      2 Nicole Apelian   200 yards of 30 lb test fishing line, 100 yards of 8…
##  6      6 Barry Karcher    Saw                                                  
##  7      1 Alan Kay         Large 2-quart pot                                    
##  8      9 Tom Garstang     Folding Saw                                          
##  9      7 Kielyn Marrone   Snare wire                                           
## 10      6 Woniya Thibeault Pot

3. inner_join

Describe the resulting data:

How is it different from the original two datasets?

survivalists_small %>% inner_join(loadouts_small, by = c("season", "name" ))
## # A tibble: 1 × 4
##   season name               age item_detailed
##    <dbl> <chr>            <dbl> <chr>        
## 1      1 Chris Weatherman    41 Knife

4. left_join

Describe the resulting data:

How is it different from the original two datasets?

survivalists_small %>% inner_join(loadouts_small, by = c("season", "name" ))
## # A tibble: 1 × 4
##   season name               age item_detailed
##    <dbl> <chr>            <dbl> <chr>        
## 1      1 Chris Weatherman    41 Knife

5. right_join

Describe the resulting data:

How is it different from the original two datasets?

survivalists_small %>% inner_join(loadouts_small, by = c("season", "name" ))
## # A tibble: 1 × 4
##   season name               age item_detailed
##    <dbl> <chr>            <dbl> <chr>        
## 1      1 Chris Weatherman    41 Knife

6. full_join

Describe the resulting data:

How is it different from the original two datasets?

survivalists_small %>% inner_join(loadouts_small, by = c("season", "name" ))
## # A tibble: 1 × 4
##   season name               age item_detailed
##    <dbl> <chr>            <dbl> <chr>        
## 1      1 Chris Weatherman    41 Knife

7. semi_join

Describe the resulting data:

How is it different from the original two datasets?

survivalists_small %>% inner_join(loadouts_small, by = c("season", "name" ))
## # A tibble: 1 × 4
##   season name               age item_detailed
##    <dbl> <chr>            <dbl> <chr>        
## 1      1 Chris Weatherman    41 Knife

8. anti_join

Describe the resulting data:

How is it different from the original two datasets?

survivalists_small %>% inner_join(loadouts_small, by = c("season", "name" ))
## # A tibble: 1 × 4
##   season name               age item_detailed
##    <dbl> <chr>            <dbl> <chr>        
## 1      1 Chris Weatherman    41 Knife