1. Import your data

Import two related datasets from TidyTuesday Project.

clutch_size_cleaned <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-03-03/clutch_size_cleaned.csv')
## Rows: 53 Columns: 7
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (1): locality
## dbl  (5): individual, age, eggs, body_mass_grams, straight_carapace_length_mm
## date (1): date
## 
## ℹ 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.
tortoise_clean <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-03-03/tortoise_body_condition_cleaned.csv')
## Rows: 10174 Columns: 9
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): individual, season, locality, sex
## dbl (5): year, year_recode, body_mass_grams, body_condition_index, straight_...
## 
## ℹ 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:

Data1L clutch_size_cleaned

Data 2: Tortoise_clean

set.seed(1234)

clutch_size_cleaned_small <- clutch_size_cleaned %>% select(body_mass_grams, individual, locality) %>% sample_n(10)

tortoise_clean_small <- tortoise_clean %>% select(body_mass_grams, individual, locality) %>% sample_n(10)

clutch_size_cleaned_small
## # A tibble: 10 × 3
##    body_mass_grams individual locality
##              <dbl>      <dbl> <chr>   
##  1            1518        444 Konjsko 
##  2            2093        514 Konjsko 
##  3            1971        829 Konjsko 
##  4            1639       1570 Plateau 
##  5             957       1096 Beach   
##  6             973       1218 Beach   
##  7            1841        743 Konjsko 
##  8            2047         30 Konjsko 
##  9             541       1363 Beach   
## 10             804       1222 Beach
tortoise_clean_small
## # A tibble: 10 × 3
##    body_mass_grams individual locality
##              <dbl> <chr>      <chr>   
##  1            1565 1770       Plateau 
##  2            1185 1446       Plateau 
##  3             886 167        Plateau 
##  4            1163 565        Plateau 
##  5             821 1503       Plateau 
##  6             897 1217       Plateau 
##  7            1122 375        Plateau 
##  8             857 251        Plateau 
##  9            1272 160        Plateau 
## 10             874 327        Plateau

3. inner_join

Describe the resulting data:

How is it different from the original two datasets?

clutch_size_cleaned_small %>% inner_join(tortoise_clean_small, by = c("body_mass_grams", "locality"))
## # A tibble: 0 × 4
## # ℹ 4 variables: body_mass_grams <dbl>, individual.x <dbl>, locality <chr>,
## #   individual.y <chr>

4. left_join

Describe the resulting data:

How is it different from the original two datasets?

clutch_size_cleaned_small %>% left_join(tortoise_clean_small, by = c("body_mass_grams"))
## # A tibble: 10 × 5
##    body_mass_grams individual.x locality.x individual.y locality.y
##              <dbl>        <dbl> <chr>      <chr>        <chr>     
##  1            1518          444 Konjsko    <NA>         <NA>      
##  2            2093          514 Konjsko    <NA>         <NA>      
##  3            1971          829 Konjsko    <NA>         <NA>      
##  4            1639         1570 Plateau    <NA>         <NA>      
##  5             957         1096 Beach      <NA>         <NA>      
##  6             973         1218 Beach      <NA>         <NA>      
##  7            1841          743 Konjsko    <NA>         <NA>      
##  8            2047           30 Konjsko    <NA>         <NA>      
##  9             541         1363 Beach      <NA>         <NA>      
## 10             804         1222 Beach      <NA>         <NA>

5. right_join

Describe the resulting data:

How is it different from the original two datasets?

clutch_size_cleaned_small %>% right_join(tortoise_clean_small, by = c("locality"))
## # A tibble: 10 × 5
##    body_mass_grams.x individual.x locality body_mass_grams.y individual.y
##                <dbl>        <dbl> <chr>                <dbl> <chr>       
##  1              1639         1570 Plateau               1565 1770        
##  2              1639         1570 Plateau               1185 1446        
##  3              1639         1570 Plateau                886 167         
##  4              1639         1570 Plateau               1163 565         
##  5              1639         1570 Plateau                821 1503        
##  6              1639         1570 Plateau                897 1217        
##  7              1639         1570 Plateau               1122 375         
##  8              1639         1570 Plateau                857 251         
##  9              1639         1570 Plateau               1272 160         
## 10              1639         1570 Plateau                874 327

6. full_join

Describe the resulting data:

How is it different from the original two datasets?

tortoise_clean_small %>% full_join(clutch_size_cleaned_small, by = c("body_mass_grams"))
## # A tibble: 20 × 5
##    body_mass_grams individual.x locality.x individual.y locality.y
##              <dbl> <chr>        <chr>             <dbl> <chr>     
##  1            1565 1770         Plateau              NA <NA>      
##  2            1185 1446         Plateau              NA <NA>      
##  3             886 167          Plateau              NA <NA>      
##  4            1163 565          Plateau              NA <NA>      
##  5             821 1503         Plateau              NA <NA>      
##  6             897 1217         Plateau              NA <NA>      
##  7            1122 375          Plateau              NA <NA>      
##  8             857 251          Plateau              NA <NA>      
##  9            1272 160          Plateau              NA <NA>      
## 10             874 327          Plateau              NA <NA>      
## 11            1518 <NA>         <NA>                444 Konjsko   
## 12            2093 <NA>         <NA>                514 Konjsko   
## 13            1971 <NA>         <NA>                829 Konjsko   
## 14            1639 <NA>         <NA>               1570 Plateau   
## 15             957 <NA>         <NA>               1096 Beach     
## 16             973 <NA>         <NA>               1218 Beach     
## 17            1841 <NA>         <NA>                743 Konjsko   
## 18            2047 <NA>         <NA>                 30 Konjsko   
## 19             541 <NA>         <NA>               1363 Beach     
## 20             804 <NA>         <NA>               1222 Beach

7. semi_join

Describe the resulting data:

How is it different from the original two datasets?

tortoise_clean_small %>% semi_join(clutch_size_cleaned_small, by = c("locality"))
## # A tibble: 10 × 3
##    body_mass_grams individual locality
##              <dbl> <chr>      <chr>   
##  1            1565 1770       Plateau 
##  2            1185 1446       Plateau 
##  3             886 167        Plateau 
##  4            1163 565        Plateau 
##  5             821 1503       Plateau 
##  6             897 1217       Plateau 
##  7            1122 375        Plateau 
##  8             857 251        Plateau 
##  9            1272 160        Plateau 
## 10             874 327        Plateau

8. anti_join

Describe the resulting data:

How is it different from the original two datasets?

clutch_size_cleaned_small %>% anti_join(tortoise_clean_small, by = c("locality"))
## # A tibble: 9 × 3
##   body_mass_grams individual locality
##             <dbl>      <dbl> <chr>   
## 1            1518        444 Konjsko 
## 2            2093        514 Konjsko 
## 3            1971        829 Konjsko 
## 4             957       1096 Beach   
## 5             973       1218 Beach   
## 6            1841        743 Konjsko 
## 7            2047         30 Konjsko 
## 8             541       1363 Beach   
## 9             804       1222 Beach