Adding the csv file names as a separate column to the csv file
Hello
I have multiple CSV files (14000) in a folder and all of them have the same column heads (temperature, humidity, ..) and rows of my CSV files are five minutes time steps for all the year. I need to combine all the CSV files, using bind_rows to have one single CSV file. How can I add the file name as a column to my final file to be able to recognize which rows belong to what file's name? ( For example, the first file name is home1 and the second one is home 2 and I want to see which row belongs to home 1 and which row belongs to the second home?
• 454 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Use (edit)
lapplyto read and adding an id column to your files. Then do rbind on the files. This would give you what you want:Hello paramount.amin!
We believe that this post does not fit the main topic of this site.
Not a bioinformatics question.
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!