"reached elapsed time limit" R 中的错误



我在 R 中不断收到"达到已用时间限制"错误。我正在使用工作室。

这是我尝试运行的代码,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  

每次运行它时,我都会收到有关达到已用时间限制的错误消息。每次这样做时,图形中都会缺少一些东西,无论是图例、轴、网格线、点、颜色等。每次的错误消息也不同,例如:

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

这些错误似乎都没有涉及我的任何数据。这是一台新安装了R和Rstudio的电脑,以及我的数据文件,如下所示:

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

是保存在PC上的唯一.csv。

我对此错误的含义以及如何解决它有点困惑,当我用谷歌搜索此错误时,我真的不明白其他答案。

编辑,这里是会话信息((

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

下面是数据集的一些示例,它相对较小:

> 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(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  

有时运行gc()可能会有所帮助: https://community.rstudio.com/t/reached-elapsed-time-limit-warnings-rstudio/36647/4

我遇到了同样的问题,并随机尝试运行dev.off().它对我有用..

我遇到了同样的问题。重新安装 RStudio 没有帮助。

就我而言,通过以下方式从全局环境中删除所有对象rm(list = ls())暂时解决了问题 - 清除全局环境后的第一个绘图已完成。然而,在第二次绘图中,部分情节再次缺失。 值得注意的是,当我将绘图导出为 pdf 时,完整绘图已正确导出。

一直清除全球环境是可怕的解决方法;我很想听到更好的解决方案。

我遇到了同样的问题。对我有用的是,首先运行构成情节的脚本部分。停。然后才运行旨在生成绘图的代码。 所以关于你的脚本,将:首先运行除最后一个(文档图(之外的所有代码。然后运行docgraph.我没有用你的脚本尝试过这个,但你可以试一试。无论出于何种原因,它确实适用于我的情况。

我在这里添加我的答案,以防其他人遇到同样的问题。 我的 ggplot2 图有一个零星的问题,缺少轴和注释。当我选择一个代码块并只运行该块时,通常会出现问题(如果我从头到尾运行整个脚本,我通常不会有问题(。user12671124的建议(从上面(有效,但有点痛苦。 我终于找到了问题的根本原因。 我有一个数据点超出了绘图的范围。 每当情节生成时,我都会收到警告消息。 一旦我删除了一个有问题的数据点,我还修复了缺少绘图元素的问题。

我遇到了同样的错误。 我在一些计算中添加了as.double(((特别是"as.double(2730.94/3682(,as.double(5052.23/12308("(,它解决了我的问题。

我遇到了类似的问题,并且为我的 RStudio 项目禁用 git 版本控制有效; 信用 https://stackoverflow.com/a/41997420/2577275

最新更新