Skip to content

Instantly share code, notes, and snippets.

View MiGuyB's full-sized avatar

MiGuyB

  • London
View GitHub Profile
@JoachimGoedhart
JoachimGoedhart / Read-all-csv-files-into-dataframe.R
Last active May 14, 2024 14:09
Reads all *.csv files from working directory and moves the data into a single dataframe
require(data.table)
require(dplyr)
#Get a list with all csv files from the directory that is set as 'working directory'
filelist = list.files(pattern="*.csv$")
#read all csv files with data.table::fread() and put in df_input_list
df_input_list <- lapply(filelist, fread)
#reading in csv files can also be done using the base R function read.csv(), without needing to load package "data.table":