ialm ialm - 1 year ago 112
R Question

Is it possible to get RStudio to show function arguments and descriptions for custom functions?

The code completion in RStudio is great, and I really like how a popover appears to describe the arguments for the function inputs. For example, if one types

and then presses "tab", a list of arguments for the
function appears, along with a description of the input. Say,
is selected, then the adjoining window describes the
input as "the desired number of rows.".

Can I get RStudio to do this for my custom functions? Would I have to create a package to achieve this effect?

Say I have a file full of custom functions,
, and I store all my miscellaneous helper functions in there. I want to be able to add meta data for my functions so that this helper window also describes my function inputs.

Answer Source

To add to Hadley's answer in the comments, Rstudio is mining specific portions of the help files to generate the helper window. Specifically, tabbing before the parentheses brings up the "Usage" and "Description" sections and tabbing inside the parentheses or after a comma brings up the "Arguments" section. Therefore, not only does a package need to be made, but the help files must be generated to take advantage of this feature.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download