I'm trying to run a k-fold cross-validation using data from an Excel spreadsheet. Every time I get to the "train" function, it breaks providing this error:
"Can't find column `x` in `.data`."
I'll provide my code below, but if someone could at least inform me on what exactly data is supposed to equal at least that would be a great start. In previous code, I just had data equal my Excel spreadsheet data.
setwd("C:\\Users\\Gerlitz\\Documents")
library(readxl)
x<-read_excel("test_data(copy).xlsx", sheet = "R", range = "B1:I481")
data("x")
set.seed(123)
train.control<- trainControl(method = "cv", number = 10)
model<-train(x$Ndif~0+x$`flmint soybean^2`+x$`spmaxt soybean`+x$`spprecip(mar)`+x$`flmint*harv`+x$`cyield^1.9`+x$`NrateA-50/1.11`+x$`spprecip*til`
,data = x, method = "lm", trControl = train.control)