"long vectors not supported yet" error in Rmd but not in R Script
Asked Answered
R

2

76

I am operating matrices with R 3.1 and RStudio 0.99.

I have my R Script and with cmd+enter it works without problem.

I created an Rmd for reporting but I have this error

Error in lazyLoadDBinsertVariable(vars[i], from, datafile, ascii, compress,  : 
  long vectors not supported yet: ../../../../R-3.3.1/src/main/connections.c:5600
Calls: <Anonymous> ... <Anonymous> -> <Anonymous> -> lazyLoadDBinsertVariable
Execution halted

Is there a way to bypass that error?

This seems to be a dupicate of Large Matrices in R: long vectors not supported yet

but the difference is that this only happens when trying to create an Rmd, not in any other case

Robotize answered 9/9, 2016 at 17:40 Comment(4)
how many no of observations are you working with?Factory
Possible duplicate of Large Matrices in R: long vectors not supported yetMegacycle
it is a 28630x50247 matrix but the error only appears with the RmdRobotize
Also check this: github.com/yihui/knitr/issues/572Megacycle
D
108

I also ran into this today, and fixed it by using cache.lazy = FALSE in the setup chunk in my .Rmd.

So what is inside of the first chunk in my R Markdown file looks like this:

library(knitr)
knitr::opts_chunk$set(cache = TRUE, warning = FALSE, 
                      message = FALSE, cache.lazy = FALSE)
Dade answered 6/12, 2016 at 20:17 Comment(4)
This is the right answer. I just wanted to add that for whatever reason, I had to access it from options instead of opts_chunk$set. So I had options(cache = TRUE, warning = FALSE, message = FALSE, cache.lazy = FALSE). I'm on RStudio 3.2.2 if that makes any differenceTanika
This is probably sue if you are caching a very big R object. That was my problem.Dalhousie
Using the original answer with knitr::opts_chunk$set worked for me on R 3.5.1.Gamecock
For more background read bookdown.org/yihui/rmarkdown-cookbook/cache-lazy.htmlHelainehelali
O
9

I am getting the same error in my .rmd file while trying to knit it to pdf. The incriminated code chunk was cached.

Is there a way to bypass that error?

Removing the 'cache = TRUE' or setting it to FALSE seems to fix the issue.

Ochs answered 18/10, 2016 at 9:11 Comment(3)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewSalacious
Hi. I wasn't caching. I cached now and it happens with or without caching. A possible solution was already commented.Robotize
Thank @Salacious for the clarification. I don't get why I am being downvoted because the solution I suggest actually fixed the problem for my script.Ochs

© 2022 - 2024 — McMap. All rights reserved.