R is a functional programming language, and one of it's primary benefits is it's ability to create open and transparent functions.
As John Chambers says in his excellent book "Software for Data Analysis: Programming with R":
Computations are organized around functions, which can encapsulate specific, meaningful computational results, with implementations that can be examined for correctness.
Notions such as "reproducible research" and "trustworthy software" are at the heart of R development. In general, it is easy to examine a function just by typing its name without parenthesis. For instance:
> which
function (x, arr.ind = FALSE)
{
if (!is.logical(x))
stop("argument to 'which' is not logical")
wh <- seq_along(x)[x & !is.na(x)]
dl <- dim(x)
...
My question is: how do you example the contents of functions such as for()
or if()
without downloading the R source code?
Edit: Incidentally, I understand that this won't help viewing compiled code (such as C, C++, or Java) that may be called from R. I'm really wondering if there is an R function which output's R functions.