2016-08-16 63 views
1

我最近更新RStudio 3.3.1,從那時起,當我運行下面的代碼使用dplyr時,R告訴我「此應用程序已請求運行時以不尋常的方式終止它」。R 3.3.1崩潰與dplyr

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

任何人都可以告訴我,如果我做的事情特別愚蠢嗎?它用來做工精細...

非常感謝

sessionInfo()

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 
+0

post your sessionInfo() –

+0

您確定group_by()和summarize()中指定的每個變量都存在於您的數據集中嗎?當我輸入使用dplyr的變量名稱時,我得到RStudio崩潰。 –

+0

3.3.1是R版本。你使用的是最新版本的Rstudio? (不應該是個問題,但是...) –

回答

2

這可以通過在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)) 
+0

謝謝@ r.bot。變量名是絕對正確的,並且它已經在相同的數據集上工作過 – Annemarie

+0

我已經修復了它謝謝你,我認爲它不起作用,因爲第一個肌鈣蛋白缺少一些記錄。刪除了它運行的這些記錄,但它之前的工作原理缺少值,所以我很困惑它爲什麼會不高興。謝謝大家的幫助 – Annemarie