Skip to content
Prev 199470 / 398506 Next

How to see any R package code?

You have a couple of options:
1) typing the name of the function will list the source within your R
console. For example:
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: