We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
require(caret) #> Loading required package: caret #> Loading required package: lattice #> Loading required package: ggplot2 mdle<-function(daata){ return( train(x = data.frame(daata[,2:length(daata[1,])]), y = daata[,1], method = "lm", tuneLength = 1) ) } bse<-rnorm(100) d<-data.frame(a=bse,b=bse+rnorm(100)) lmd <- mdle(d[,c(1,2)]) #model with only x yox = predict(lmd,newdata=d[c(2)]) #> Error in eval(predvars, data, env): object 'daata...2.length.daata.1.....' not found
Created on 2020-04-08 by the reprex package (v0.3.0)
sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-w64-mingw32/x64 (64-bit)
The text was updated successfully, but these errors were encountered:
The problem is in how mdle subsets columns:
mdle
Browse[2]> names(data.frame(daata[,2:length(daata[1,])])) [1] "daata...2.length.daata.1....."
compared with the columns you give to predict():
predict()
> names(d[c(2)]) [1] "b"
It is expecting the same name.
Sorry, something went wrong.
No branches or pull requests
Created on 2020-04-08 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: