You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Rename in Scope" across chunks in R Markdown #4961
The "Rename in Scope" operation in the Code menu is really handy in R scripts, but not quite as nice in R Markdown documents. It appears to work only within a chunk, whereas the scoping model in R Markdown is that all "r" chunks that are evaluated act like a single script.
For example,
Here I define a variable:
```{r}
bad.var.name <- runif(1)
# [close chunk]
And here I print its value:
```{r}
bad.var.name
# [close chunk]
(where # [close chunk] is supposed to be the three backticks to close the chunk). If I put this in an R Markdown document, then try to Rename in Scope the bad.var.name, only the one in the same chunk gets changed.
Activity
ronblum commentedon Jun 18, 2019
@dmurdoch Thank you for bringing this up! We'll target this for the next major release of RStudio.
domwoolf commentedon May 5, 2020
same problem in R scripts when comments separating sections look like chunk headers
For example:
Ends up like this
stale commentedon Feb 5, 2021
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.
dmurdoch commentedon Feb 5, 2021
This is still present in RStudio 1.4.1103.
danmyles commentedon Nov 9, 2021
Another option might be to add more options to the Cmd+F menu, for instance: within scope and within chunk?
NewGraphEnvironment commentedon Nov 30, 2021
Does anyone have any workarounds that they can share to rename in scope over an entire rmd doc?
viktorpm commentedon May 29, 2024
Is there any update on this?
ronblum commentedon Oct 2, 2024
Verified in RStudio Desktop 2024.11.0-daily+258 on Windows 11.
Opened two related issues: #15262 for visual mode, and #15263 for sections in an R script.