11.6 Cache large objects
When the chunk option
cache = TRUE, cached objects will be lazy-loaded into the R session, which means an object will not be read from the cache database until it is actually used in the code. This can save you some memory when not all objects are used later in the document. For example, if you read a large data object but only use a subset in the subsequent analysis, the original data object will not be loaded from the cache database:
However, when an object is too large, you may run into an error like this:
If this problem occurs, you can try to turn off the lazy-loading via the chunk option
cache.lazy = FALSE. All objects in this chunk will be immediately loaded into memory.