I am working with R in VS code and I am facing this error whenever I want to view tbl_df from read_sav function.
Error: C stack usage 7956480 is too close to the limit
Interestingly, I don’t get this error on R Studio.
Here is a reproducible example:
library(haven)
path <- system.file("examples", "iris.sav", package = "haven")
df <- read_sav(path)
view(df)
Changing to data.frame doesn’t solve the issue.
Update:
sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin20
Running under: macOS 15.1.1
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: Europe/London
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] haven_2.5.4
loaded via a namespace (and not attached):
[1] utf8_1.2.4 R6_2.5.1 tzdb_0.4.0 magrittr_2.0.3
[5] glue_1.8.0 tibble_3.2.1 pkgconfig_2.0.3 lifecycle_1.0.4
[9] readr_2.1.5 cli_3.6.3 fansi_1.0.6 vctrs_0.6.5
[13] compiler_4.4.1 forcats_1.0.0 hms_1.1.3 pillar_1.9.0
[17] rlang_1.1.4 jsonlite_1.8.9
Thanks.
2
Answers
Have you tried uppercase
View(df)
? I’m not sure where the lowercaseview
comes from but it doesn’t come from haven. But where ever it comes from it sounds like it’s recursively calling itself.I had the same problem. No Idea what causes it. But what helped me was saving the df as csv and then loading it in again. No more problems!