repr icon indicating copy to clipboard operation
repr copied to clipboard

tibbles nested inside tibbles cause infinite recursion in repr_html

Open michaelquinn32 opened this issue 2 years ago • 0 comments

Hi team!

Here's a reprex

library(repr)
library(tibble)

tbl_obj <- tibble::tibble(
  col1 = tibble::tibble(
    inner_col1 = 1
  )
)
repr::repr_html(tbl_obj)
Error: C stack usage  23918976 is too close to the limit
Execution halted

The issue is related to this line of code: https://github.com/IRkernel/repr/blob/f4780e5ab58054d69ef77a0f61b239bebd106de5/R/utils.r#L162

I think the problem is indexing behaviors in tibbles vs data frames. A data frame will "drop" and return a vector if only one column is selected. tibbles don't do this by default. Setting drop = TRUE should fix it.

michaelquinn32 avatar Jul 30 '22 00:07 michaelquinn32