I like using the RStudio snippets.
I thought it would be great, if i can select code and add it to the snippets by keyboard shortcut.
Even if I edit the r.snippets file programmatically, the created snippet seems only to be updated if the r.snippets
file will be
opened afterwards (in RStudio). As a workaround i call file.edit("~/.R/snippets/r.snippets")
at the end of the code.
My questions:
- Does the file have to be opened or can the changes be recognised by RStudio in another way as well?
- Would it be better practise to directly navigate to the
a) modalDialog() like in my example? (assuming the r.snippets file does not have to be opened)
b) or directly paste the selected code in the r.snippets file?