Some simple RStudio addins

Posted on February 3, 2022 by Stéphane Laurent
Tags: R, misc

In this blog post I introduce three small RStudio addins I did.

‘bracketify’

I prefer subsetting with the double brackets than with the dollar in R, because this is more readable in RStudio thanks to the syntax highlighting. That’s why I did bracketify. This addin replaces all occurrences of foo$bar with foo[["bar"]], either in a whole file or only in the current selection.

To use carefully: if you have some dollar symbols in your code which are not used for subsetting (e.g. in a regular expression), they can be transformed by bracketify.

‘pasteAsComment’

Originally, I made pasteAsComment to paste the content of the clipboard as a comment:

I updated this package today. Now it also allows to paste the content of the clipboard as roxygen lines. This is particularly useful to write some code in the @examples field:

‘JSconsole’

JSconsole is available on CRAN. This addin allows to send some selected JavaScript code to the V8 console. This is useful when you want to test a function.