I have a great number of csv files I have made into a list using the "list.files" function:
list.files("C:/Users/gyero/Documents/daphnia/SUMMARY_CHIMP")
I want to use the gather() function on each file and then sink() to produce a separate output for each csv file. I need some way to identify which output file corresponds to which input file.
To loop through files I had a crack at using lapply()
lapply(list.files[1:33], function{gather(WELL,MEASURE,A1:D6)})
I'm not sure how to get a corresponding output file name- so I tried preceding the lapply function with the following code so at least the output files would have a unique name and not get overwritten:
sink('DATA.CSV')
paste0(Sys.time(),'DATA.CSV')
However, I am very new to this and having trawled the internet I still can't realize my goal (the above didn't work). I would be MASSIVELY grateful to anyone who could spare the time to help a desperate noob out.