Is there a function in r to read multiple data files which have matching columns into a single dataframe? -


i have multiple .txt files, of similar in format different values , want combine them single dataframe.

is there function in r read multiple data files have matching columns single dataframe?

if want append datasets, can following :

store names of datasets in vector using dir() :

> files <- dir("data/") 

read files using lapply() , read.csv or other similar function (ie read_csv() in readr package) :

> lfiles <- lapply(files, function(x) {read.csv(paste0("data/", x))}) 

put dataframes using do.call() , rbind

> df <- do.call(rbind, lfiles) 

Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -