namespaces - 错误 : 'attrition' is not an exported object from 'namespace:rsample'

标签 namespaces

我正在使用 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/

相关文章:

javascript - 描述 typescript .d.ts 文件的嵌套对象

c++ - C++命名空间名和类名重复会导致冲突吗?

c++ - 在同一个头文件中定义底层的顶层类初始化

xmlns 命名约定

PHP:在命名空间内使用子命名空间类

c++ - 有没有办法在全局命名空间中调用类?

c++ - 嵌套命名空间中的重复符号

namespaces - TCL 包和命名空间

python - 如何将 Python 标识符转换为数字?

namespaces - 在命名空间下组织大量类