简体   繁体   中英

How to load multiple files in R?

I have three files I want to load in. They are all CSV's. I want to load all three files all at once into one combined dataframe. I want to do this so I don't have to go through three lines of loading in the files separately and then an additional line binding them all. I also want to save room in my Global Environment and having three dataframes loaded when I will combine them all into one will just take up room and make things confusing. I can click and view each dataframe separately but they aren't merged like I wanted them to be. How can I load in the files at once and merge them without reading each file one after another?

Use purrr::map_dfr() :

files <-  purrr::map_dfr(filelist, read.csv)

(All data frames have the same columns as my understanding.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM