I am a beginner in R and have recently transitioned from STATA to R. So, it's been an uphill battle. I was able to write a vectorized command to read csv
files recursively as discussed here Sapply vs. Lapply while reading files with factors. Here's my code:
filenames<-list.files(path="~/Documents/R Programming/Data/",pattern=".csv")
appended_filename<-sapply(filenames, function(x) paste("~/Documents/R Programming/Data/",x,sep = ""))
Merged_file<-do.call(rbind,lapply(appended_filename,read.csv))
However, I have about 50+ files. The challenge is that there is no way I can know whether there is an issue with reading any of the files. Is there any way to print the status such as "1 2 ..."
(I am not looking for anything pretty...just an update on what's going on) just to know how many files have been read?
I am a beginner so I am not sure how to add a function that would show me some visibility in this. As a fall-back option, I have manually coded read.csv()
function to test and check each file and finally rbind()
function before running the above command. This is extremely painful.