Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"reached elapsed time limit" errors in R

Tags:

I keep getting "reached elapsed time limit" errors in R. I'm using studio.

This is the code I am trying to run, a simple graph in ggplot:

require(ggplot2)
docgraph <- ggplot(data = plotnvto, aes(calluna, doc)) + 
  geom_point(aes(x = calluna, y = doc, color = "calluna"), size = 3) + 
  geom_point(aes(x = sedge, y = doc, colour = "sedge"), size = 3) +
  geom_smooth(aes(calluna,doc), method=lm, se=FALSE, color = "purple") +
  geom_smooth(aes(sedge,doc), method=lm, se=FALSE, color = "green") +
  scale_colour_manual("", 
                      values = c("calluna"="purple", "sedge"="green")) +
  labs(x= "Percent Cover", y= "DOC (mg/L)") +
  annotate(geom="text", x=10, y=36, label="y = -0.4498x + 26.6843
R² = 0.1836, p = 0.1646",color="purple") +
  annotate(geom="text", x=30, y=36, label="y = -0.5058x + 16.0603
R² = 0.1026, p = 0.3012",color="darkgreen") +
  theme_bw() +
  xlim(0,60) +
  ylim(0,50)
docgraph  

Everytime I run it, I get an error message about reaching the elapsed time limit. Every time it does this, something is missing from the graph, whether this is the legend, axes, grid lines, dots, colours etc. The error message is also different every time, e.g:

In depth(x$children[[length(x$children)]], ...) :
  reached elapsed time limit

In paste(names[seq_len(n - 1L)], collapse = .grid.pathSep) :
  reached elapsed time limit

In lapply(X = X, FUN = FUN, ...) : reached elapsed time limit

In x$vp : reached elapsed time limit

None of these errors appear to refer to any of my data. This is a pc with R and Rstudio freshly installed and my data files, which look like this:

 summary(vegdocverages2016)
 plotslope      month    siteplot      ee6             h254             h400             doc              suva        
 plot :12   march  :12   MC:4     Min.   :1.886   Min.   : 962.9   Min.   : 192.9   Min.   : 7.109   Min.   :0.08819  
 slope:12   october:12   MT:4     1st Qu.:2.773   1st Qu.:2216.8   1st Qu.: 445.4   1st Qu.:15.428   1st Qu.:0.10732  
                         NC:4     Median :3.074   Median :3037.5   Median : 544.3   Median :21.407   Median :0.12451  
                         NT:4     Mean   :3.013   Mean   :2947.6   Mean   : 560.6   Mean   :22.373   Mean   :0.12649  
                         WC:4     3rd Qu.:3.345   3rd Qu.:3712.2   3rd Qu.: 666.4   3rd Qu.:27.371   3rd Qu.:0.13597  
                         WT:4     Max.   :3.639   Max.   :4735.5   Max.   :1070.4   Max.   :45.668   Max.   :0.17626  
    calluna          sedge           sphag             moss            bare       
 Min.   : 3.75   Min.   :15.11   Min.   : 0.000   Min.   : 7.50   Min.   : 1.250  
 1st Qu.:11.25   1st Qu.:16.75   1st Qu.: 0.000   1st Qu.:24.12   1st Qu.: 8.417  
 Median :15.28   Median :30.03   Median : 2.222   Median :28.89   Median :20.728  
 Mean   :16.55   Mean   :29.94   Mean   : 3.097   Mean   :27.98   Mean   :18.136  
 3rd Qu.:21.44   3rd Qu.:38.65   3rd Qu.: 4.514   3rd Qu.:30.25   3rd Qu.:25.875  
 Max.   :33.75   Max.   :52.50   Max.   :13.500   Max.   :54.50   Max.   :32.500  
Warning message:
In dontCheck(fnname) : reached elapsed time limit

Are the only .csv saved on the PC.

I'm a little confused about what this error means and how to fix it, and I don't really understand the other answers when I have googled this error.

edit, here is the sessionInfo()

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

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] ggmap_2.6.1   ggplot2_3.0.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17      pillar_1.2.3      compiler_3.5.1    plyr_1.8.4        bindr_0.1.1       tools_3.5.1      
 [7] digest_0.6.15     tibble_1.4.2      gtable_0.2.0      lattice_0.20-35   pkgconfig_2.0.1   png_0.1-7        
[13] rlang_0.2.1       Matrix_1.2-14     mapproj_1.2.6     proto_1.0.0       bindrcpp_0.2.2    withr_2.1.2      
[19] dplyr_0.7.6       stringr_1.3.1     RgoogleMaps_1.4.2 maps_3.3.0        grid_3.5.1        tidyselect_0.2.4 
[25] glue_1.2.0        R6_2.2.2          jpeg_0.1-8        sp_1.3-1          purrr_0.2.5       reshape2_1.4.3   
[31] magrittr_1.5      scales_0.5.0      assertthat_0.2.0  colorspace_1.3-2  geosphere_1.5-7   labeling_0.3     
[37] stringi_1.1.7     lazyeval_0.2.1    munsell_0.5.0     rjson_0.2.20     
Warning message:
In unlist(x, recursive = FALSE) : reached elapsed time limit

And here's some examples of the dataset, which is relatively small:

> head(vegdocverages2016)
  plotslope month siteplot      ee6    h254   h400      doc       suva calluna sedge sphag  moss  bare
1      plot march       NC 2.906985 3117.30 613.20 21.48609 0.12880545    3.75 52.50   0.0  7.50 25.00
2      plot march       NT 2.943432 2153.04 516.12 18.29540 0.09992877   25.55 15.75   0.0 30.25 28.50
3      plot march       MC 1.942531 1024.80 192.90 12.62613 0.12917354   22.00 22.00   0.0 54.50  1.25
4      plot march       MT 2.581118 1985.82 356.28 13.07213 0.16446263   11.25 38.75  13.5 29.50  7.00
5      plot march       WC 2.670563 2238.00 388.40 27.37139 0.12932109   10.65 16.75   3.0 45.40 23.40
6      plot march       WT 2.804038 1931.50 526.80 27.37139 0.12932109   10.65 16.75   3.0 45.40 23.40

summary:

> summary(vegdocverages2016)
  plotslope            month             siteplot              ee6             h254             h400       
 Length:24          Length:24          Length:24          Min.   :1.886   Min.   : 962.9   Min.   : 192.9  
 Class :character   Class :character   Class :character   1st Qu.:2.773   1st Qu.:2216.8   1st Qu.: 445.4  
 Mode  :character   Mode  :character   Mode  :character   Median :3.074   Median :3037.5   Median : 544.3  
                                                          Mean   :3.013   Mean   :2947.6   Mean   : 560.6  
                                                          3rd Qu.:3.345   3rd Qu.:3712.2   3rd Qu.: 666.4  
                                                          Max.   :3.639   Max.   :4735.5   Max.   :1070.4  
      doc              suva            calluna          sedge           sphag             moss            bare       
 Min.   : 7.109   Min.   :0.08819   Min.   : 3.75   Min.   :15.11   Min.   : 0.000   Min.   : 7.50   Min.   : 1.250  
 1st Qu.:15.428   1st Qu.:0.10732   1st Qu.:11.25   1st Qu.:16.75   1st Qu.: 0.000   1st Qu.:24.12   1st Qu.: 8.417  
 Median :21.407   Median :0.12451   Median :15.28   Median :30.03   Median : 2.222   Median :28.89   Median :20.728  
 Mean   :22.373   Mean   :0.12649   Mean   :16.55   Mean   :29.94   Mean   : 3.097   Mean   :27.98   Mean   :18.136  
 3rd Qu.:27.371   3rd Qu.:0.13597   3rd Qu.:21.44   3rd Qu.:38.65   3rd Qu.: 4.514   3rd Qu.:30.25   3rd Qu.:25.875  
 Max.   :45.668   Max.   :0.17626   Max.   :33.75   Max.   :52.50   Max.   :13.500   Max.   :54.50   Max.   :32.500  
like image 740
Will Avatar asked Jul 09 '18 13:07

Will


1 Answers

Sometimes running gc() may help: https://community.rstudio.com/t/reached-elapsed-time-limit-warnings-rstudio/36647/4

like image 167
jarauh Avatar answered Oct 20 '22 23:10

jarauh