Search code examples
rr-faq

View the source of an R package


Is there an easy way to view the source of an R package (or a method in a package), from within the interactive environment?


Solution

  • Just enter the name of a function/method without parentheses:

    R> base::rev.default 
    function (x) 
    if (length(x)) x[length(x):1L] else x
    <environment: namespace:base>
    

    See also R-Help Desk - Accessing the Sources in R News Volume 6/4, October 2006.