I have many csv files that are seperated by day. I wrote a code to manually import each one add a date column and export them again.
But this requires me entering hundreds of file names to change the same code over many lines. I want to create a function that loops through and adds the date column based on the name and then exports a new csv.
By doing this I essentially have to enter every file into this formula to achieve what I want. Is there a way to do this without all of the manual labor.
Oct0418 <- read.csv("10.04.18 (x).csv")
Oct0418$Date <- as.Date("2018/10/04")
write.csv(Oct0418, "10.04.18.csv")
Oct1118 <- read.csv("10.11.18 (x).csv")
Oct1118$Date <- as.Date("2018/10/11")
write.csv(Oct1118, "10.11.18.csv")