【问题标题】:R 3.3.1 crashing with dplyrR 3.3.1 与 dplyr 崩溃
【发布时间】:2016-08-16 09:06:07
【问题描述】:

我最近将 RStudio 更新到 3.3.1,从那时起,当我使用 dplyr 运行以下代码时,R 告诉我“此应用程序已请求运行时以不寻常的方式终止它”。

max_trop <- df %>% group_by(record_id) %>% summarise(max= max(troponin, na.rm=TRUE))

如果我在做一些特别愚蠢的事情,谁能告诉我?它曾经工作得很好......

非常感谢

会话信息()

R version 3.3.1 (2016-06-21)Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1 
locale:[1] LC_COLLATE=English_United Kingdom.1252  
LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C   
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] dplyr_0.5.0

loaded via a namespace (and not attached):
[1] magrittr_1.5   R6_2.1.2       assertthat_0.1 DBI_0.4-1     
 tools_3.3.1        tibble_1.1     Rcpp_0.12.6   

【问题讨论】:

  • 发布你的 sessionInfo()
  • 您确定 group_by() 和 summarise() 中指定的每个变量都存在于您的数据集中吗?当我错误输入使用 dplyr 的变量名时,我会导致 RStudio 崩溃。
  • 3.3.1 是 R 版本。您使用的是最新版本的 Rstudio 吗? (应该不是问题,但是...)
  • 分离然后重新安装 Rcpp 和 dplyr(先分离 dplyr,然后在重新安装时,先安装 Rcpp。如果这不起作用,请先尝试重新安装 dplyr。

标签: r dplyr


【解决方案1】:

这可能是由于在 dplyr 链中获取了错误的变量名造成的。解决方案是检查数据集中存在的变量中提供的内容。

data("mtcars")
library(dplyr)

# Runs
mtcars %>% summarise(mean(mpg))

# crashes with message 'This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.'
mtcars %>% summarise(mean(mag))

【讨论】:

  • 谢谢@r.bot。变量名肯定是正确的,之前在同一个数据集上工作过
  • 我已经解决了,谢谢。我认为它不起作用,因为有几条记录缺少第一个肌钙蛋白。当我删除这些记录时,它会运行。不过,它以前曾在缺失值的情况下工作过,所以我很困惑为什么它不高兴。谢谢大家的帮助
猜你喜欢
  • 1970-01-01
  • 2014-02-16
  • 2016-11-29
  • 1970-01-01
  • 1970-01-01
  • 2015-07-07
  • 2016-01-17
  • 2014-09-28
  • 2015-11-04
相关资源
最近更新 更多