我正在使用 Bradley Boehmke 所著的 Hands on Machine Learning 一书。我写了以下行来访问数据,但我给出了这个错误。
损耗 <- rsample::attrition
错误:“损耗”不是从“命名空间:rsample”导出的对象
最佳答案
我以前遇到过同样的问题,但后来我发现现在attrition
DataFrame 属于 modeldata
包裹。只需使用以下代码:
# Load the required libraries first
my_libraries <- c("rsample","modeldata","caret", "h2o", "dplyr",
"ggplot2")
lapply(my_libraries, require, character.only = T)
# **PROBLEM STATEMENT** here: there is a list of ordered factor variables,
# which is not_possible for h2o to deal with.
# for Job attrition data
churn <- attrition %>% mutate_if(is.ordered, .funs = factor,ordered = F)
# NOTE: funs() can create a list of function calls.
churn.h2o <- as.h2o(churn)
churn.h2o %>% View()
关于namespaces - 错误 : 'attrition' is not an exported object from 'namespace:rsample' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65397753/