Error on train() function in R [closed]

。_饼干妹妹 提交于 2019-12-25 09:29:04

问题


I am trying to learn from an online example and got stuck on one part. Particularly when i use train() function. I got an error saying train isn't a function. I did research and believe train is a function. The code i copied was : xgb_tree_model = train(SalePrice~., data=train, method="xgbTree", trControl=control, tuneGrid=grid, metric="rmsle", maximize = FALSE)

The site I am using is http://hamelg.blogspot.com/2016/09/kaggle-home-price-prediction-tutorial.html


回答1:


You can check step by step.

  1. Check if package is installed. Check using following command.

    find.package(c("caret"),lib.loc=NULL,quiet=FALSE, verbose = getOption("verbose"))

    it will show you package path if found else show you error message.

  2. If package is not installed, install it by using install.packages("caret") this will install package.

  3. Now load your caret package using library(caret)

  4. call train() function. Now you should not get error message.



来源:https://stackoverflow.com/questions/44403712/error-on-train-function-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!