Last active
February 18, 2022 01:34
-
-
Save ksonda/4d0f9a096afc13f86445f28f54de9887 to your computer and use it in GitHub Desktop.
combine csvs in R
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
library(readr) | |
library(dplyr) | |
csv_directory <- "." | |
output_directory <- "./results" | |
filenames <- list.files(csv_directory,pattern="*.csv") | |
all_files <- Reduce(bind_rows, lapply(filenames, read_csv, col_types = cols(.default = "c"))) | |
write_csv(all_files, paste0(output_directory,"/all_files.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment