I have created the following loop for reporting the prediction error of polls in 2016.
for(i in 1:51){ state.data<-subset(polls, subset=(state==statenames[