feederwatch <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-01-10/PFW_2021_public.csv')
## Rows: 100000 Columns: 22
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (8): loc_id, subnational1_code, entry_technique, sub_id, obs_id, PROJ_P...
## dbl (14): latitude, longitude, Month, Day, Year, how_many, valid, reviewed, ...
##
## ℹ 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.
site_data <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-01-10/PFW_count_site_data_public_2021.csv')
## Rows: 254355 Columns: 62
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): loc_id, proj_period_id
## dbl (60): yard_type_pavement, yard_type_garden, yard_type_landsca, yard_type...
##
## ℹ 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.
describe the data sets data 1: feederwatch columns: loc_id , PROJ_PERIOD_ID,species_code row:1-10
data 2: site_data columns:loc_id, proj_period_id, numfeeders_suet row:1-10
set.seed(1234)
feederwatch_small <- feederwatch %>% select(loc_id, PROJ_PERIOD_ID, species_code) %>% sample_n(10) %>% janitor::clean_names()
site_data_small <- site_data %>% select(loc_id, proj_period_id, numfeeders_suet) %>% sample_n(10)
feederwatch_small
## # A tibble: 10 × 3
## loc_id proj_period_id species_code
## <chr> <chr> <chr>
## 1 L12896176 PFW_2021 whtspa
## 2 L12744873 PFW_2021 houfin
## 3 L12726635 PFW_2021 dowwoo
## 4 L8112697 PFW_2021 amegfi
## 5 L12761982 PFW_2021 tuftit
## 6 L24457 PFW_2021 eucdov
## 7 L5187485 PFW_2021 moudov
## 8 L8757955 PFW_2021 daejun
## 9 L217527 PFW_2021 dowwoo
## 10 L12772384 PFW_2021 norcar
site_data_small
## # A tibble: 10 × 3
## loc_id proj_period_id numfeeders_suet
## <chr> <chr> <dbl>
## 1 L37787 PFW_2008 4
## 2 L1803099 PFW_2021 4
## 3 L10860534 PFW_2021 3
## 4 L29442 PFW_2003 1
## 5 L8125373 PFW_2020 0
## 6 L80901 PFW_2012 5
## 7 L77784 PFW_2015 2
## 8 L37449 PFW_2001 3
## 9 L4101017 PFW_2020 2
## 10 L72372 PFW_2000 0
data: columns: row:
feederwatch_small %>% inner_join(site_data_small)
## Joining with `by = join_by(loc_id, proj_period_id)`
## # A tibble: 0 × 4
## # ℹ 4 variables: loc_id <chr>, proj_period_id <chr>, species_code <chr>,
## # numfeeders_suet <dbl>
Divide it using dplyr::select in a way the two have a common variable, which you could use to join the two.
Use tidyr::left_join or other joining functions.