Sometimes when caching chunks in markdown variables can't be referenced in next chunk, why?



I'm very confused as to why when I cache a chunk sometimes the variables can't be referenced even though explicitly stated before. I got an example to work if I printed it in second chunk before first chunk. So to give details, my preferences are:
knitr::opts_chunk$set(cache = TRUE, warning = FALSE,
message = FALSE, cache.lazy = FALSE)

In this instance it doesn't work (don't print)

I"ll post other picture in reply since I can only upload one image due to new member


and in this case it does work (print function)

Can someone explain to me why and how i can fix this?


Hi @achits! Welcome!

To help people understand your problem, it's a good idea to provide the R Markdown source, not just the output (when doing so, please be sure to format it properly:sparkles: so the forum doesn't garble it :smile:).

It's even better if you can post a small, reproducible example (so, one that doesn't rely on a large data object only you have). I'm not familiar with seurat objects myself, but I wonder if you see the same issue if you use the sample data object from the Seurat "Get Started" page?

closed #4

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