(Bug) Why are base R and R3 methods not transparently showing their code in R-studio in an open source way?

When you control + left click a function in Rstudio it prints this instead of revealing the source code.

Reproducible example:

  1. Open a new Rscript.
  2. Type "plot()"
  3. Hold down "Ctrl" + "Left-Click"
  4. Instead of producing the source code, it reproduces this....
# ERROR: Definition of function 'plot' not found
# in namespace 'package:graphics'

Instead of:

function (x, y, ...) 

Which then has 50 different plot() methods. While the example is trivial, I am very concerned that R will not be as transparent or or easy to use if new users cannot click to understand how various functions work. Transparency of code is one of the tenets of Open Source (Reference: The open source way | Opensource.com). So I am reporting this as a bug with the Rstudio product in hopes that someone will come up with a work around or easy GUI fix to Rstudio so R remains as transparent as it was in 3.6.3

RStudio is a GUI to the R programming language, so this tool isn't the right target. The ability to view some types source code here is a convenience feature.

Interpreted functions work differently from compiled functions. Entering arima on the console, without () will show an R script, because it's only byte compiled. Entering the name of a compiled function will not show the C or other source code from which it was compiled.

That doesn't mean that the source code is unavailable, it's just not so easily discoverable. You can browse the source code and some of it will have external libraries, which in turn must be ferreted out.

plot and many other functions are generic, which means that they can be dispatched by methods in other functions, according to the class of their respective objects. (The italicized all have defined meanings in the language specification.)

Most users for most purposes are better off using the function descriptions available through help() to understand what a function does in terms of the arguments it takes and the values it returns. On occasion, reading the source code for the implementation helps better to understand some of the finer points.

There's a good summary on this S/O post.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.