当我在r中执行代码时,我得到了下面的错误。
optbin(train)错误:could not find function "optbin"回溯:
下面是我的代码:#Read datasets
#Download the data from http://www.saedsayad.com/datasets/CreditData.zip
train <- read.csv("Credit_train.csv")
test <- read.csv("Credit_test.csv")
#Rows and Cols
dim(train)
dim(test)
#Columns name
colnames(train)
colnames(test)
#Show
head(train)
head(test)
#------
# OneR
#------
#remove all records with missing values
train <- na.omit(train)
test <- na.omit(test)
#binning the numerical variable
train.bin <- optbin(train)
#train
model.OneR <- OneR(DEFAULT~., data = train.bin, verbose = TRUE)
summary(model.OneR)
plot(model.OneR)
#test
pc <-NULL
pc <- predict(model.OneR, test, type = "class")
eval_model(pc,test)
我已经应用了oneR包,它仍然不工作。我必须做什么才能解决这个错误?
在使用函数
之前尝试使用library
或require
加载库library(OneR)
或者您可以使用名称空间说明符
OneR::optbin