[R] Viewing function source

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 26 19:00:02 CEST 2003


Most of the time you just use

rpois

or, to use a pager,

page(rpois)

For some functions the function is hidden from the end user, and for those 
(indeed, for any object the system can find) you can use

getAnywhere("foo.bar")


In your example, it will not be too revealing:

> rpois
function (n, lambda)
.Internal(rpois(n, lambda))

....

On Tue, 26 Aug 2003, Paul Meagher wrote:

> I know I should probably RTFM for this question, but could someone tell me
> if R supports the idea of "viewing source" on any particular function you
> want to use?
> 
> If I want to "view source" on the rpois() function, for example, can I do
> somethink like:
> 
> source(rpois)
> 
> To see how the function is implemented?


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list