I'm reading this SO post.
The top voted answer for reading multiple csv files into a single dataframe is:
file_names <- dir() #where you have your files
your_data_frame <- do.call(rbind,lapply(file_names,read.csv))
My question is, suppose I have 5 files and I'd like to add a column on the new dataframe indicating which order the file was read in, 1 through 5. How can I do that? Do I have to doa. for loop using an iterator i or is there a neat way to encompass with the short code block above?