I'm trying to resolve the loop so that it iterates over the year_value and resolves to 2017, 2018, and 2019 but keep getting an error message
Error in eval(lhs, parent, parent) : object 'Import_API_' not found
The data here is actually not important. I already have three existing objects: Import_API_2017, Import_API-2018, and Import_API_2019. What I want is to do some data cleaning and get MyData_2017 by reading and doing the cleaning in Import_API_2017 and so on and so forth. I don't want to essentially rewrite the whole thing all over again for 2018 and 2019.
year_value <- c(2017:2019)
for (i in year_value){
MyData_[i] <- Import_API_[i]%>%
row_to_names(row_number = 1) %>%
mutate(across(where(is.character), str_trim)) %>%
rename(Commodity_Code = I_COMMODITY, Commodity_Description = I_COMMODITY_SDESC) %>%
filter(SUMMARY_LVL == "DET")
}