[R] Howto view function's source code of an installed package

Sicotte, Hugues Sicotte.Hugues at mayo.edu
Tue Sep 28 21:26:12 CEST 2010


The instructions below are for examining files from a source code file. 
For package binaries, the R code may be in a binary file (.rdb).. Then
the following will help.

The first thing to try is to
Download and install the package and type library(packagename)

Type the function name (without the ()). All exported functions will be
visible (export commands in the NAMESPACE file of each package). In a
compiled packages, some internal functions may not be "exported" and be
visible.



Hugues
 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Mark Miller
Sent: Tuesday, September 28, 2010 2:10 PM
To: r-help at r-project.org
Subject: Re: [R] Howto view function's source code of an installed
package



I justed wanted to provide a description of how I was able to view
source
code of a function.

First download the Program R package containing the function.
Specifically,
download the file that ends in "tar.gz".  This is a compressed file.
Expand
the compressed file using, for example, "WinZip".  Next open the
uncompressed file that ends in ".tar".  I was able to open that file
with
the free software "7-Zip" available on the internet.  After installing
that
software I clicked on the file "7zFM.exe" and navigated to the directory
containing the ".tar" file.  You can extract the contents of that ".tar"
file into a new folder.  The contents consist of R files showing the
source
code for the functions in the R package.  These R files can be opened
with a
text editor.

Hopefully, it is okay to mention other software here by name.  I have
used
the above method twice in the last few months to view source code for
functions.  In both instances I needed a substantial amount of time to
figure out how to do it.  This post might help others and perhaps will
help
myself in the future.

Mark W. Miller

Gainesville, Florida


-- 
View this message in context:
http://r.789695.n4.nabble.com/Howto-view-function-s-source-code-of-an-in
stalled-package-tp831711p2717744.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.



More information about the R-help mailing list