Like the tittle says, I am trying to do k-fold cross validation. my coding skills are very basic, please explain as simply as possible.
"""
library(ISLR)
install.packages("ISLR")
library(ISLR)
install.packages("boot")
library(boot)
data <- attach(read.csv("TutWk7Data-1.csv",header=TRUE))
MSE = NULL
for (i in 1:7){
model = glm(Y~poly(X,i),data=data)
MSE[i] = cv.glm(data,model,K=10)$delta[1]
}
""" I get this error Error in poly(X,i):object "i" not found