Reputation: 2707
I've new to R and I've successfully install a package. I would like to examine the source code of this package. I understand that I can view the source of a given function by just typing the name of the function at the prompt. How can I get access to the source code files such that I can browse it?
Thanks.
Upvotes: 3
Views: 438
Reputation: 118799
As @Spacedman wrote under R-help list, why so shy about mentioning the package?.
Go to CRAN page for the package and just download the source directly and extract the files. All R files will be under R
directory and any C
files will be under src
directory.
Upvotes: 4
Reputation: 60944
It is easiest to just download the source package from CRAN, extract the tar.gz
file (e.g. using 7zip or tar
), browse to the /R
subfolder and open the file that contains the code. If you are not really sure where a particular function is located, you can use a tool like grep
to look for it, e.g.:
grep spam_function *
if you are looking for spam_function
.
Upvotes: 3