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.
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. >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 -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul
Zhijiang Wang wrote:> Dear All, > I want to see a R package code, how can I do that? > what file in the package?See the R Help Desk Ligges, U. (2006): R Help Desk: Accessing the Sources. R News 6 (4), 43-45, available from http://journal.r-project.org/ Best, Uwe Ligges> -- > > 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.
Thank you very very much!!!! Though I have known it now. Uwe Ligges ??????: Zhijiang Wang wrote: Dear All, I want to see a R package code, how can I do that? what file in the package? See the R Help Desk Ligges, U. (2006): R Help Desk: Accessing the Sources. R News 6 (4), 43-45, available from [1]http://journal.r-project.org/ Best, Uwe Ligges -- 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. ______________________________________________ [2]R-help at r-project.org mailing list [3]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [4]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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. http://journal.r-project.org/ 2. mailto:R-help at r-project.org 3. https://stat.ethz.ch/mailman/listinfo/r-help 4. http://www.R-project.org/posting-guide.html
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:> > Dear All, > I have modified a .R code (/usr/local/lib/R/site-library/ > brainwaver/R),What did you "modify"? How did you modify it?> but > when I run 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 -- David> 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 > ______________________________________________ > 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.David Winsemius, MD Heritage Laboratories West Hartford, CT
On 11/06/2009 02:24 AM, Zhijiang Wang wrote:> 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? > >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
For a code .R file, I add a function in it. But I saw it was not modified in command window, while it was changed in "/usr/local/lib/R/site-library/brainwaver/R" by openning it by editor. So I doubt the two are different, but I just find one version this .R file, which was just in the above directory. David Winsemius ??: On Nov 5, 2009, at 10:24 AM, Zhijiang Wang wrote: Dear All, I have modified a .R code (/usr/local/lib/R/site-library/brainwaver/R), What did you "modify"? How did you modify it? but when I run 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: [1]http://cran.r-project.org/doc/manuals/R-exts.html -- 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. http://cran.r-project.org/doc/manuals/R-exts.html
You have to use R CMD REMOVE "Package NAME" to uninstall the package(from Command line) . Then R CMD build brainwaver.tar.gz the R CMD INSTALL brainwaver.tar.gz to re install then the changes you made you be effective Zhijiang Wang wrote:> > > 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 > ______________________________________________ > 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/Re%3A-How-to-see-any-R-package-code--tp26211013p26226551.html Sent from the R help mailing list archive at Nabble.com.
You have to use R CMD REMOVE "Package NAME" to uninstall the package(from Command line) . Then R CMD build brainwaver.tar.gz the R CMD INSTALL brainwaver.tar.gz to re install then the changes you made you be effective Zhijiang Wang wrote:> > > 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 > ______________________________________________ > 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/Re%3A-How-to-see-any-R-package-code--tp26211013p26226552.html Sent from the R help mailing list archive at Nabble.com.
Thank you Jim! The problem is solved now. Jim Lemon ??????: On 11/06/2009 02:24 AM, Zhijiang Wang wrote: 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? 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 -- 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.
You have a couple of options: 1) typing the name of the function will list the source within your R console. For example:> lswill 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.