简体   繁体   English

当我使用 tidyverse 中的“传播”功能时,RStudio 继续崩溃

[英]RStudio continues to crash when I use the "spread" function from the tidyverse

I'm trying to spread a dataframe, but R continues to crash everytime I try.我正在尝试传播数据帧,但每次尝试时 R 都会继续崩溃。 I can use other functions from the tidyverse, like mutate, filter, etc, but I'm unable to use spread.我可以使用 tidyverse 中的其他功能,例如 mutate、filter 等,但我无法使用 spread。 When I try to cancel the code, a Terminate R dialog box pops up explaining that R is not responding to my request to interrupt the current operation and that I should terminate R.当我尝试取消代码时,会弹出一个终止 R 对话框,说明 R 没有响应我中断当前操作的请求,我应该终止 R。

I've tried uninstalling and then reinstalling tidyr and tidyverse, but no luck.我试过卸载然后重新安装 tidyr 和 tidyverse,但没有运气。

Does anyone have an idea as to why this might be happening or a possible solution to the problem?有没有人知道为什么会发生这种情况或问题的可能解决方案?

I had this problem once.我曾经遇到过这个问题。 I noticed it occurs after use group_by and summarize.我注意到它在使用 group_by 和汇总后发生。 dplyr converts the new dataset class to "grouped_df" "tbl_df" "tbl" "data.frame" and for some reason that I don't know spread does not work properly. dplyr 将新的数据集类转换为"grouped_df" "tbl_df" "tbl" "data.frame"并且由于某种我不知道传播不能正常工作的原因。

If that is your case, just force the class to be data.frame with the as.data.frame (dataset) command before submitting your dataset to the spread function.如果是这种情况,只需在将数据集提交给扩展函数之前,使用as.data.frame (dataset)命令强制类为 data.frame。

It worked for me!它对我有用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM