README.md

RStudio addins

RStudio addins let you execute a bit of R code or a Shiny app through the RStudio IDE, either via the Addins dropdown menu or with a keyboard shortcut. Coupled with functions from the rstudioapi package, this means you can operate on your own R code, which is awesome.

jadd

This package holds a couple addins I've made that have nothing to do with any specific package.

rstudioapi_addin

This is sort of meta. This addin calls functions from the rstudioapi package that you might use in your own addin. You can select text (or not) and activate the source editor (or the Console), then call this addin to expose all the information available returned by these functions:

Results are both print()ed and str()ed. It's not beautiful, but it gets the job done. You are in a better to position to program with these functions after you see the gory details with your own eyes.

To use this addin:

An animation of the above

assign_defaults_addin

The assign_defaults_addin helps you develop and debug a function. Scenario: you're working on a function and need to walk through the body as if it were top-level code. But it is a PITA to set all the arguments to their default values. So you just fiddle with the function at arms length, convinced you can spot the problem and fix it this way. Sure you can.

Define your function. Select its name and Addins > Assign default values will make assignments to the global environment. Arguments that have a default will be set to that value. Arguments with no default are ignored -- you must set those to something sensible yourself. And ... must be dropped, so have fun with that too! Fix your function. When you're feeling lucky, restart R to clean out global environment and load/test the function properly.

To use this addin:

An animation of the above

Observations on the development process

Take with a grain of salt, because I have ~~two~~ ~~four~~ eight entire hours of experience at this point.



jennybc/jadd documentation built on Sept. 27, 2020, 10:35 a.m.