I have a bunch of values I want to read in to an if statement in R. Namely:
year_1 , year_2
for(i in 1:15) {
     Update Ok your answer seems to be on the right track. I should have been a bit more specific and say that I am reading the data from an excel file of parameters and using the data to produce plots. Different data sets will have different years active. The core of this problem is telling R how many years are active, starting from param$year_1 to param$year_15. So I am trying to actually read param$year_1 and so on for example, and basically check whether it is empty or not which will allow me to know how many years this particular data set is working with. When I tried
 mget(paste0("param$year_", 1:5)) Update 2
I am sure the difficulty with this comes down to my description. But here is exactly what I want to produce but automated to a few lines as I know I will want to do similar operations like this is in the future. What the actual data is is irrelevant. This non automated version produces exactly what I want.
Non Automated Code
    if(is.na(param$year_1[1]) == TRUE || param$year_1[1] == '') {
    print("empty")
    }
    if(is.na(param$year_2[1]) == TRUE || param$year_2[1] == '') {
    print("empty")
    }
    if(is.na(param$year_3[1]) == TRUE || param$year_3[1] == '') {
    print("empty")
    }
    if(is.na(param$year_4[1]) == TRUE || param$year_4[1] == '') {
    print("empty")
    }
so on and so on until the final
    if(is.na(param$year_15[1]) == TRUE || param$year_15[1] == '') {
    print("empty")
    }
It is such a simple thing to do in C++ but I have to learn it in R for the future.
 
    