This is the code I have for now, I keep getting an error that fd is undefined, I tried defining it as fd=data.frame() but it doesn't work.
Code:
file<-list.files(pattern=".csv$")
#file creates a list of csv file names
for (i in seq_along(filenames))
{
fd[i]<- read.csv(file[i])
#read each csv file
output=c("o1.RDS","o2.RDS","o3.RDS")
#save each csv file as RDS every iteration,
#with the name as specified in the vector output.
saveRDS(fd[i],file =output[i])
}