如何从recipes::step_dumm() 中排除Char 变量?
如何在配方中保持character
ID 变量PERSON_ID
不变?我尝试了 update_role(PERSON_ID , new_role = "id variable") 并尝试将其从 step_dummy 中排除 step_dummy(all_nominal_predictors(), -all_numeric_predictors(), -all_outcomes(), -has_role(match = “id 变量”)
它仍然无法将 PERSON_ID 转换为任何因素。 建议?
How do I keep a character
ID variable PERSON_ID
unchanged in a recipe? I tried update_role(PERSON_ID , new_role = "id variable")
and tried excluding it from step_dummy step_dummy(all_nominal_predictors(), -all_numeric_predictors(), -all_outcomes(), -has_role(match = "id variable")
. It does not work. It still converts PERSON_ID to factor. Any suggestion?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是一个令人困惑的问题。按照配方函数文档,step_factor2string 应该将因子转换为字符串。
然而,当您瞥见菜谱时,它会为 PERSON_ID 注明“fct”。另一方面,如果将 strings_as_factors 设置为 FALSE,则会出现错误,表明 PERSON_ID 不是一个因素:
This seems to be a confusing one. Following the recipe function documentation, step_factor2string should convert factors to strings.
However, when you glimpse at the recipe it states "fct" for PERSON_ID. On the other side an error appears, if you set strings_as_factors to FALSE, stating that PERSON_ID is not a factor: