Skip to content

Intermittent "reached elapsed time limit" when nesting  #1565

Closed
@tmcd82070

Description

@tmcd82070

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions