Top 5 RStudio Addins for productivity and quality of life

Introduction

RStudio Addins let you execute a bit of R code or a Shiny app through the RStudio IDE, either via the Addins drop-down menu or with a keyboard shortcut.

Addin list and corresponding addinslist package let you “browse RStudio addins”.

This is a list of my top 5 favorite Addins and several very relevant mentions.

 

Top 5

1. GPTStudio for automatic spelling, code commenting and code creation

This package is coupled with GPTtools and OpenAI.

# Install
install.packages("openai")
if (!require(remotes))
    install.packages("remotes")
remotes::install_github("MichelNivard/gptstudio")

# For use needs API key
Sys.setenv(OPENAI_API_KEY = "<APIKEY>")    #  OpenAI API key

The addin works on text selection:

“Spelling and Grammar”

“Comment your code”
“Write/Code from prompt”

 

2. Static code analysis (linting) and code styling

  • lintr with lintr::use_lintr(type = "tidyverse")

In order to show the “Markers” pane in RStudio: Menu “Tools” -> “Global Options…”, a window with title “Options” will pop up. In that window: click “Code” on the left; click “Diagnostics” tab; check “Show diagnostics for R”.

“Lint current file”

lintr is complementary to the styler package which automatically restyles code, eliminating some of the problems that lintr can detect.

  • styler with styler::tidyverse_style()

“Style section” / “Style active file”

Beyond addin use, lintr and styler are excellent at R project level, coupled with precommit package. Read more about this workflow on this r-bloggers post.

 

3. Search R packages on CRAN

  • CRANsearcher for interactive CRANsearcher::CRANsearcher()

  • pkgsearch for pkgsearch::pkg_search("key words")

# For addin to work must install:
install.packages("shinyWidgets")
install.packages("whoami")

# pkgsearch::pkg_search_addin(query = "key word", viewer = c("dialog", "browser"))

“CRANsearcher” / “CRAN Package Search”

 

4. Reproducible examples with datapasta & reprex

E.g. use datapasta::tribble_paste() from .xlsx to R tibble and then reprex::reprex({code goes here}, venue = "so") to make a reproducible example in a separate environment, copy output to clipboard and then just paste it to StackOverflow. The same steps can be achieved through addins:

“Paste as tibble” + “Reprex selection”

 

5. caseconverter for name conversions

if (!require(remotes))
  install.packages("remotes")
remotes::install_github("strboul/caseconverter")

“To upper case” / “To lower case” / “To snake case”

 

Important mentions:

6. blogdown

Especially for blogdown::new_post() and blogdown::serve_site().

7. bookdown

Especially for bookdown::serve_book().

8. Scheduling with cronR or taskscheduleR

cronR for Unix/Linux - cronR::cron_rstudioaddin()

taskscheduleR for Windows - taskscheduleR::taskscheduler_create()

# For taskscheduleR RStudio addin to work, also install:
install.packages("miniUI")
install.packages("shiny")

9. colourpicker

Especially for colourpicker::colourWidget()

Claudiu-Cristian Papasteri
Claudiu-Cristian Papasteri
Psychologist, Psychotherapist, Researcher

Related