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

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

Open
AKRosenblad opened this issue May 7, 2020 · 1 comment
Labels
non-atomic column e.g. list columns, S4 vector columns

Comments

@AKRosenblad
Copy link

AKRosenblad commented May 7, 2020

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 `

@jangorecki
Copy link
Member

Thank you for reporting. If you want to use matrix inside data.table columns, you need to wrap it into list.

fun <- function(x) list(noquote(as.matrix(x)))

@jangorecki jangorecki added the non-atomic column e.g. list columns, S4 vector columns label May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
non-atomic column e.g. list columns, S4 vector columns
Projects
None yet
Development

No branches or pull requests

2 participants