1 RStudio
A collection of notes about programming in RStudio – including notes about modifying RStudio locally.
1.1 Find and Replace Tool
Notes on using RStudio’s Find and Replace tool. This can be a real time saver!
1.1.1 Regular Expressions
These notes should be specifically about using Regular Expressions in RStudio’s Find and Replace tool. See Chapter 2 for notes about regular expressions in general.
1.1.1.1 Substituions
I was working on making updates to Intro to R. While converting Rmd documents to Qmd documents, I was looking for a way to use the find and replace tool to convert the code chunk options from their knitr style (i.e., {eval=FALSE}
) to the Quarto style (i.e., #| eval: false
). Using this SO post, I did some experimenting in regex101 and found a solution. Here it is:
Find code (with leading space): eval=FALSE}
Replace code: }\n#| eval: false\n
It turns out that the substitution part is pretty straightforward in this case, but I think that stack overflow post will be useful for more complicated cases when I have to use capture groups as well.