[R] General Question on learning R...

Liaw, Andy andy_liaw at merck.com
Wed May 4 03:57:49 CEST 2005


For an installed package (rather than source), the R-ex/ directory contains
the code in the Example section of help pages; e.g., if you run
example(somefun), the code in somefun-ex.R is source()'ed.

Stuff in the demo/ directory are executed by the demo() function, and it's
optional:  Most packages do not have demo code.

Andy

> From: Spencer Graves
> 
> 	  Yes.  Thanks for the elaboration.  What differences 
> might one expect 
> between the contents of "\demo" and "\R-ex"?  (I found 
> "\R-ex" with all 
> the packages I named, but not all had "\demo".)
> 
> 	  spencer graves
> 
> There seem to be different
> 
> Jonathan Q. wrote:
> 
> > assuming one has these installed already, you just look in the demo
> > folder under each?  i.e., fBasics\demo ???
> > 
> > On 5/3/05, Spencer Graves <spencer.graves at pdf.com> wrote:
> > 
> >>         I'm looking at the same thing.  A good source for 
> this is to
> >>'install.packages(c("fBasics", "fCalendar", "fExtremes", 
> "fMultivar",
> >>"fOptions", "fPotfolio", "fractdiff", "fSeries", "its", "lme4",
> >>"zoo"))', then 'update.packages()'.  These will install 
> subdirectories
> >>or folders with the indicated names "fBasics", etc., in 
> "library" with
> >>your R installation.  For example, in my Windows 
> installation, I have
> >>"D:\Program files\R\rw2010pat\library", which contains many 
> subfolders
> >>including ones named "fSeries".  These all contain files 
> "*.R", which
> >>provide sample code.
> >>
> >>         spencer graves
> >>
> >>Sean Davis wrote:
> >>
> >>
> >>>On May 3, 2005, at 6:46 AM, Jonathan Q. wrote:
> >>>
> >>>
> >>>>In the process of learning R, with a specific interest on 
> financial
> >>>>time series.  While I continue to get through the 
> documents I am more
> >>>>a fan of learning by example and then looking up how each 
> function is
> >>>>used.  Any websites which post sample code for R?
> >>>>
> >>>
> >>>The largest source of example code is R itself.  If you 
> have a command
> >>>in which you are interested, you can often just type the 
> command and the
> >>>code will be shown to you.  Try typing:
> >>>
> >>>ls()
> >>>
> >>>Then:
> >>>
> >>>ls
> >>>
> >>>It will show you the code used to produce the result.  Also, each
> >>>command has its own example(s) in the help.
> >>>
> >>>Sean
> >>>
> >>>______________________________________________
> >>>R-help at stat.math.ethz.ch mailing list
> >>>https://stat.ethz.ch/mailman/listinfo/r-help
> >>>PLEASE do read the posting guide!
> >>>http://www.R-project.org/posting-guide.html
> >>
> > 
> >
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 
>




More information about the R-help mailing list