Executing a code deletes object in the environment

Hello everyone,

I ran into this issue and it's driving me crazy since I cannot properly work. When I execute a code in Rmarkdown it deletes all my objects in the environment, runs the first chunk of my code and return a message: object "whatever object I'm working on at the moment" not found. Did someone had a similar issue and could suggest some solutions? Thanks!

Is this while knitting or just running the chunks?

When you knit, it does try to run the notebook from a fresh environment for the purpose of reproducibility. So, that's how it's supposed to work.

It's when running a chunk. Let's say I assigned some values to a tibble and then I run some filter functions on that tibble in some other chunk and boom it deletes the objects in the environment and says that it cannot find the object that I'm working with. So I need to go again to assign the values to the tibble etc. I have a feeling it might be Rmarkdown so I installed it again but nothing changed. I'll try to work on a script for a bit and see if it repeats there.

Do you face the issue you describe when you interact with this example R markdown document ?

title: "test"
output: html_document

mytib <- head(iris)

myfilt <- dplyr::filter(mytib,Sepal.Length>5)

No, no issues. But also it is important to mention, that it happens quite randomly. Can it be related to not enough RAM?

I wouldn't have thought so.
Its very challenging to debug issues that are not reproducible... sorry

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.