Rstudio bug with Replace All?

Has anyone else seen this bug? It's bitten me a few times now. When I do a "Replace All" across the whole document, all my inline output chunks in my R Notebook disappear.

I'm currently running Rstudio Version 1.1.463 on Mac OS X.

That's not a bug, that's a feature. Whenever input to the chunk changes, it is logical to assume that output changes as well. So output is invalidated and waits for you to run the chunk again.

1 Like

Thanks for your reply.

The problem is that chunks with no change are also wiped clean. I can understand the philosophy behind this not-bug. My problem is that I find that selecting search/replace within selection-only vs document-wise to be pretty futzy and will sometimes accidentally do global when I meant to do selection-only. Once I’ve made that mistake, I can undo the replace, but I can’t undo the cleared-out output. That might be a few hours of computation time, if not more.

I'm pretty sure I've experienced similar behaviour before, but at this point it's been a while, so not sure what was the sequence of events to cause. I've tried it with the RStudio I have (v1.2.1114) and it doesn't look anything happens if I do "Replace all".

Can you share a bit more about what you are doing exactly, so I can check it myself to see that maybe upgrading RStudio might help in your case.

Here is a very simple demonstration of the problem. If I have the content below in an R Notebook file, with the comment "# XYZ" in a different code block than the code, and do a Replace All of the string "XYZ" to anything else, then the output of the code block above it is cleared.

---
title: "R Notebook"
---

x <- 1:10
plot(x)
```{r}
# XYZ

I just tried your example in RStudio v1.2.1194 and plot didn't disappear. Can you try upgrading RStudio to see if 1.2 behaves in a more reasonable manner for you?

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.