R markdown won't knit:

First off, I tried to provide a reprex, but I'm not sure how to do replicate the issue in this case.

I have some code, which first reads a large-ish csv (4 GB), using

a <- read.csv

then manipulates it.

When I try to knit the markdown document, it loads on this page for several minutes:

"
processing file: Test-R_Markdown.Rmd
|.. | 3%
ordinary text without R code |.... | 6%
label: unnamed-chunk-1 |...... | 9%
ordinary text without R code | 11%
label: unnamed-chunk-2 |......... | 14%
ordinary text without R code |........... | 17%
label: unnamed-chunk-3

Then provides this error:

I'm new to R markdown, so I feel there may be something obvious I am missing, but I cannot think of it.

I tried:
ensuring all my packages are up to date
ensuring R is using all of my RAM (though it says the problem is a vector of 500 Mb, which seems small)
I also knit a markdown of the mtcars data frame, and it knit just fine.
Restarting RStudio with a clean environment

Hi, and welcome!

This is actually due to the OS in most cases. I used to think that R didn't do garbage collection very well, but the culprit is although R releases memory, the OS doesn't necessarily take it back into the pool that can be allocated.

Just to mention. Whenever you feel insecure about RAM during an R session, just

gc()

The help page on memory limits explains how to tweak the allowance that is limiting your program. Within the *nix it's shell specific and Windows, of course, is different yet.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.