[R] How to see any R package code?

Viknesh viknesh at stat.ufl.edu
Sun Nov 8 00:27:20 CET 2009


You have a couple of options:
1) typing the name of the function will list the source within your R
console. For example:
> ls
will list the source code for the ls() function. So once you load your
package, you can simply enter the name of the function whose source you wish
to see and you will see.

2) The above will not work if the function has not been exported via the
NAMESPACE file. In this case you have to download the .tar.gz file from CRAN
to view the source. After you unzip and untar the downloaded file, you can
look in the R/ or src/ directories for the function you are interested in.
As the names suggest, R/ contains R code, while src/ contains C or Fortran
code used in the package.

Cheers,
Vik

---
Grad Student
Department of Statistics
University of Florida



Zhijiang Wang wrote:
> 
> 
>    Dear All,
>    I want to see a R package code, how can I do that?
>    what file in the package?
> 
>    --
> 
> Best wishes,
> Zhijiang Wang
> --------------------------------------------
> PHD Student
> Room 212, Science buliding,
> The International WIC Institute,
> College of Computer Science and Technology,
> Beijing University of Technology,
> Beijing, China.
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-see-any-R-package-code--tp26210294p26249606.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list