I have 15 CSVs on google drive, and I want to download them and left join them at the same time. Thirteen have the same ID variable (inegi), but two have different ID names (CVEGEO and id_mun). How can I join the other two with different ID names in the columns? Here is the code I currently have:
# Paquetes ---------------------------------------------------------------
if(!require(pacman)) install.packages("pacman")
pacman::p_load(tidyverse, janitor, googledrive,
stringr, purrr)
# Download municipal Files -------------------------------------------------------------------
files_municipal <- drive_ls(as_id("IDOFGOOGLE")) %>%
filter(!str_detect(name, "cumulative-deaths|excess")) %>%
arrange(name)
tmp <- paste(tempdir(), files_municipal$name, sep = "/")
walk2(files_municipal$id, tmp, ~ drive_download(as_id(.x), path = .y, overwrite = TRUE))
# Join --------------------------------------------------------------------
tempo <- map(tmp, read_csv) %>%
reduce(left_join, by = "inegi")