102 rdoc - An Alfred Worflow to Search R Documentation

Darvesh Gorhe

102.1 Motivation

Looking up documentation can often be a distracting and time consuming process. It often involves moving to a separate window and out of RStudio or your preferred IDE. This can be remedied by having a second monitor but that is hardly a practical solution in all cases. It would be easier if you could see a temporary window with the information you need that disappears with a keystroke.

102.2 Alfred and Alfred Workflows

Fortunately Alfred provides such functionality and the ability to write scripts that utilize its core features. Normally Alfred is used like macOS’s built-in Spotlight feature - file searching, calculator, opening programs, etc. However, workflows allow developers to extend Alfred’s functionality with python. Users can download workflows from Alfred’s website or from anywhere else they so choose.

102.3 Where to Get rdoc

You can find and download the latest version of rdoc from this releases page. Download the file titled “Rdoc.alfredworkflow.zip”, unzip the file and open the file which should open Alfred and ask you to install the workflow. Make sure you have downloaded the latest version of Alfred. Unfortunately, you do need the paid Powerpack to use workflow functionality. It is a one-time purchase but I think it is worthwhile.

102.4 About

Get function descriptions and arguments from rdocumentation.org like “rdoc ggplot2 aes_eval”, without having to open your web browser. Currently the descriptions and function arguments are stored offline so this solution is ideal if you’re planning to be somewhere without an internet connection.

102.5 Usage

Type rdoc followed by your query which is of the form <library> <function>

Rdoc Usage
Currently only the following packages are supported
  • ggplot2
  • dplyr
  • stringr
  • tidyverse
  • tibble
  • odbc
  • foreign
  • tidyr
  • htmlwidgets
  • vcd
  • xml
  • jsonlite
  • httr
  • devtools

CMD + L to view details CMD + C to copy formatted function to clipboard

To open the web page for documentation press: ENTER