countypop$pop_2015[2044:2131] <- chosen_dataset[,chosen_index]
print(length(chosen_dataset[,chosen_index]))
This is the code I have. I'm replacing the section of data in countypop$pop_2015 with the values in chosen_dataset[,chosen_index]. However, this gives the error:
Error in <-: replacement has length zero
Yet the print statement prints 88, as desired. The entire program runs fine. Where is this error coming from?