Skip to content

How to see any R package code?

3 messages · Zhijiang Wang, David Winsemius, Jim Lemon

#
Dear All,
   I have modified a .R code (/usr/local/lib/R/site-library/brainwaver/R), but
   when I run it, why does it run the original code? Whatever I modified it,
   the results did not change.
   what happened?

   Paul Hiemstra ??????:
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.
     ______________________________________________
     [1]R-help at r-project.org mailing list
     [2]https://stat.ethz.ch/mailman/listinfo/r-help
     PLEASE do read the posting guide
     [3]http://www.R-project.org/posting-guide.html
     and provide commented, minimal, self-contained, reproducible code.


     Hi Zhijiang,
     When you want to look at the code of a particular function, pass the
     command without the brackets, e.g. for lm:
     > lm
     Alternatively,  you  can  download the source package and go to the
     subdirectory R/. All the R code is located there.
     cheers,
     Paul

   --

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.

References

   1. mailto:R-help at r-project.org
   2. https://stat.ethz.ch/mailman/listinfo/r-help
   3. http://www.R-project.org/posting-guide.html
#
On Nov 5, 2009, at 10:24 AM, Zhijiang Wang wrote:

            
What did you "modify"? How did you modify it?
How did you run it? If the "it" is just a single function that you  
altered after it was loaded into the workspace, then you should show  
us what you entered at the command line. If you were attempting to  
change the contents of a package in an R library and recompile it,  
then you should be reading:

http://cran.r-project.org/doc/manuals/R-exts.html
#
On 11/06/2009 02:24 AM, Zhijiang Wang wrote:
Hi Zhijiang,
If you modify a source code file in an external editor, you must save 
the result, then use:

source("usr/local/lib/R/site-library/brainwaver/R/mycode.R")

where "mycode.R" is the name of the file that you have modified. The 
code that you "source" will replace the previous code. It looks like you 
are modifying the code of one or more functions in the brainwaver 
package, so when you have the function working as you wish, you will 
probably want to rebuild the package, perhaps renaming it to something 
like brainwaver2. See "Writing R extensions" (R-exts.html) for 
information on how to do this. You would then be able to use:

library(brainwaver2)

instead of the original library.

Jim