I want to make a for loop with some functions I created earlier in my script
a <- read.csv("FP_2019.csv")
b <- read.csv("RH_2019.csv")
c <- read.csv("health_sector_2019.csv")
d <- read.csv("FP_2018.csv")
e <- read.csv("RH_2018.csv")
f <- read.csv("health_sector_2018.csv")
x <- read.csv("FP_2017.csv")
y <- read.csv("RH_2017.csv")
z <- read.csv("health_sector_2017.csv")
health <- c(c,f,z)
RH <- c(b,e,y)
FP <- c(a,d,x)
#loop the sectors
For(i in health) {
data_format(i)
wordsearch_health(i)
filter_data_health(i)
return(i)
}
This is what I have written and I will eventually have 3 loops one for health, RH and FP.
When I run the loop I get this error:
Error: unexpected 'in' in "For(i in"
Where can I go from here?