Error: C stack usage 15923760 is too close to the limit (probably do to noquote)

Open
#4,432 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
data

Research direction

Start with the minimal reproducible example using data.table, .SD, lapply, and noquote, and compare it with the working lapply(AB[, .SD], fun) expression. Trace the data.table evaluation path for the failing call and add a regression test showing that it no longer exhausts the C stack while preserving the working behavior.

Written by the indexing model from the issue text.

Description

non-atomic column

Seems to be a problem with noquote:

# [Minimal reproducible example]

library(data.table)
A <- rep("A", 50)
B <- rep("B", 50)
AB <- data.table(A, B)
fun <- function(x) noquote(as.matrix(x))
AB[, lapply(.SD, fun)] # not OK
#Error: C stack usage  15923760 is too close to the limit`

But the following works fine:
lapply(AB[, .SD], fun) # OK

# Output of sessionInfo()
`R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=Swedish_Sweden.1252 LC_CTYPE=Swedish_Sweden.1252 LC_MONETARY=Swedish_Sweden.1252
[4] LC_NUMERIC=C LC_TIME=Swedish_Sweden.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] data.table_1.12.8

loaded via a namespace (and not attached):
[1] compiler_4.0.0 tools_4.0.0 `

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.