Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View the source of an R package

Tags:

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

like image 544
pufferfish Avatar asked Nov 24 '09 08:11

pufferfish


People also ask

How do I view a function in R?

To view all the contents of a defined object, use the View() function. Behind the scenes, the R calls utils::View() on the input and returns it invisibly. If the input is not a data frame, it is processed using a variant of as. data.

What is R source package?

A source package is just a directory of files with a specific structure. It includes particular components, such as a DESCRIPTION file, an R/ directory containing . R files, and so on.


1 Answers

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.

like image 187
rcs Avatar answered Nov 09 '22 23:11

rcs