dplyr and lubridate chain crashing r

702 views Asked by At

I'm stuck as to why the following code is crashing R on my machine (both in rstudio and the basic R gui) - any help would be very much appreciated!

library(dplyr)
library(lubridate)


dates <- data.frame(date = seq(ymd('2015-01-01'),ymd_hms('2019-06-20 23:00:00'),by = "hour"))

# Run this section a few times (simulate many calls in a shiny app)
for(i in 1:10)
  test_df <- dates %>%
    mutate(month = month(date),
           year = year(date))

My session info:

R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
[1] lubridate_1.3.3 dplyr_0.4.2    

loaded via a namespace (and not attached):
 [1] assertthat_0.1 DBI_0.3.1      digest_0.6.8   magrittr_1.5   memoise_0.2.1  parallel_3.1.3 plyr_1.8.3     R6_2.0.1       Rcpp_0.11.6   
[10] stringi_0.4-1  stringr_1.0.0  tools_3.1.3  

Update:

I tried re-installing Rcpp then dplyr, but still ran into the same issue. Furthermore, I was also able to recreate the same issue on my mac. What I ended up doing, was rolling back a version of dplyr (0.4.1), restarting, and things are now working as to be expected. I checked the rstudio log file after a crash and saw this:

LOGGED FROM: void {anonymous}::rCleanup(bool) C:\Users\Administrator\rstudio\src\cpp\session\SessionMain.cpp:2311
18 Jun 2015 21:20:22 [rsession-cmohan] ERROR r error 4 (R code execution error) [errormsg=Error: cannot allocate vector of size 4.0 Gb|||]; OCCURRED AT: rstudio::core::Error rstudio::r::exec::{anonymous}::evaluateExpressionsUnsafe(SEXP, SEXP, SEXPREC**, rstudio::r::sexp::Protect*) C:\Users\Administrator\rstudio\src\cpp\r\RExec.cpp:149
0

There are 0 answers