How to read.table() multiple files into a single table in R?

后端 未结 2 1416
失恋的感觉
失恋的感觉 2020-12-01 08:24

I have filenames named ..csv and I\'d like to make graphs for each test. The best way I can see to do this is to make one R ta

2条回答
  •  醉话见心
    2020-12-01 08:56

    Try this:

    ## take files.
    files <- list.files(pattern=".csv")
    ## read data using loop
    DF <- NULL
    for (f in files) {
       dat <- read.csv(f, header=T, sep="\t", na.strings="", colClasses="character")
       DF <- rbind(DF, dat)
    }
    

提交回复
热议问题