I have a directory with a folder for each individual patient on a study, but multiple files within each folder for that patient. I want to run the same code in R for each folder and create a summary file.
so for example:
setwd("~/pt1")
##pull in files
T1<-read.csv('T1.csv')
T2<-read.csv('T2.csv')
T3<-read.csv('T3.csv')
T4<-read.csv('T4.csv')
## lots of code here ##
--> outputsummaryfile
Repeat for 80 more folders(patients).
I know how to create a function and pull in and run multiple files, but I'm stuck on how to pull in multiple folders and run a function on multiple files within that folder.
Any help?