It's been a while since I've touched for loops. I am simply trying to check if the value in the LocationID column is 1, and if so, set the value in the corresponding row in RegionID to 4. It should run through every value in the LocationID column.
for (i in 1:length(df$LocationID)) {
if (df_7$LocationID == 1) {
df_7$RegionID = 4
}
}
From my understanding, the code I've come up with here just checks the first value ~44000 times (the length of the dataset) and then sets every value of RegionID to 4.
Any help is greatly appreciated!