0

I am trying to read multiple data in my directory and build a data frame using and combining them. The below code helped me a lot but I want someone else, which I send the code, can use this code and can read the all files in his/her directory. This code only works for my computer apparently? Do you have any idea?

 all.the.files <- list.files("C:/temp",full=TRUE)
 all.the.data <- lapply( all.the.files,  read.csv, header=TRUE)
 DATA <- do.call("rbind", all.the.data)
2
  • You have to create a variable to store the path of the directory to read. In your code, you read "C:/temp" by default.
    – user3710546
    Feb 15, 2015 at 8:37
  • To start with, this code assumes there is a C:/ drive, that C:/temp exists, that C:/temp is full of CSV files, and that all the CSV files are compatible with respect to rbind(). You would need to be sure that all of those assumptions are true on other machines.
    – Jthorpe
    Feb 15, 2015 at 8:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.