Rstudio bug with Replace All?

rstudio

#1

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.


#2

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.


#3

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.


#4

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.


#5

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

#6

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?