Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermittent "reached elapsed time limit" when nesting #1565

Closed
tmcd82070 opened this issue Aug 5, 2024 · 2 comments
Closed

Intermittent "reached elapsed time limit" when nesting #1565

tmcd82070 opened this issue Aug 5, 2024 · 2 comments

Comments

@tmcd82070
Copy link

A strange intermittent error. And, it only occurs for one set of data frames. Other data frames run fine.

Objective: I am attempting to nest (tidyr::nest) one data frame and merge with another (dplyr::right_join).

The Problem: I get intermittent "Error in <random R statement> : reached elapsed time limit". This error pops up about 1/2 second after the R console prompt returns. The result (the nested and merged data frame) is correct. Sometimes the error does not pop up. I am using RStudio 2024.04.2 Build 764 and R version 4.4.0


Minimal Example : I spent hours minimizing the example to no avail. If I subset the data frames to ~50 observations, I get the error less frequently, but it still occurs. Removing units in one data frame does not fix it. Removing columns does not fix it. At one point I thought the full data frame was corrupted so I wrote it to text (dump) and re-sourced it (source); but, to no avail. So, I apologize that my minimal example is not very minimal. The full data frames are attached to this issue (output of dump). You may need to run the merge several times to get the error. Note I got the error 3 of 5 times I ran the same code, with different "Error in <statement>" each time.

> source("sites.R")
> source("detects.R")
> tmp <- detects |> tidyr::nest(.by = "siteID") |> dplyr::right_join(sites, by = "siteID")
> tmp <- detects |> tidyr::nest(.by = "siteID") |> dplyr::right_join(sites, by = "siteID")
Error in as.list(meta) : reached elapsed time limit
> tmp <- detects |> tidyr::nest(.by = "siteID") |> dplyr::right_join(sites, by = "siteID")
> tmp <- detects |> tidyr::nest(.by = "siteID") |> dplyr::right_join(sites, by = "siteID")
Error in file(con, "r") : reached elapsed time limit
> tmp <- detects |> tidyr::nest(.by = "siteID") |> dplyr::right_join(sites, by = "siteID")
Error in utils:::readCitationFile("C:/Program Files/RStudio/resources/app/resources/CITATION") : 
  reached elapsed time limit

The result looks correct:

> head(tmp)
# A tibble: 6 × 8
  siteID data             observer  bare  herb shrub height npoints
  <fct>  <list>           <fct>    <dbl> <dbl> <dbl>  <dbl>   <dbl>
1 C1X01  <tibble [2 × 2]> obs5      45.8  19.5  18.7   23.7       1
2 C1X02  <tibble [1 × 2]> obs5      43.4  20.2  20     23.6       1
3 C1X04  <tibble [1 × 2]> obs5      38.3  22.5  23.5   34.3       1
4 C1X05  <tibble [1 × 2]> obs5      41.5  20.5  20.6   26.8       1
5 C1X06  <tibble [1 × 2]> obs5      43.7  18.6  20     23.8       1
6 C1X08  <tibble [1 × 2]> obs5      41.5  20.1  20.9   29.4       1
@DavisVaughan
Copy link
Member

The full data frames are attached to this issue

I don't see anything attached 😢

Regardless this is an error that comes from deep in base R
https://github.com/wch/r-source/blob/0c26529e807a9b1dd65f7324958c17bf72e1de1a/src/main/sysutils.c#L2921

It is highly unlikely to be related to tidyr itself. Possibly it is related to RStudio in some way but I'm not sure.

I don't think there is anything actionable for tidyr to do though, so I'm going to close this one.

@tmcd82070
Copy link
Author

tmcd82070 commented Oct 28, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants