i have one code (fun_r1.R) which i used to run again and again for number of regions in region column.
now i am thinking like creating a list of region and then run the code one by one for all regions in "region"
also i want to create a folder for regions and then save the files in the same folder
path <- getwd()
region<- c("CA","US","UK") # code should run for the variables here one by one
for (i in region) {
folder <- paste0(path) # here i want a new folder for CA and save the output here
render (codes.r)
save.output(path)
}
if i is one of the values of region , (at first "CA" for example), then within the curly braces of your loop, some use should be found for i otherwise the loop always is doing the same thing regardless of i