[R] S data sets in R?

spencerg spencer.graves at prodsyse.com
Tue May 19 23:56:13 CEST 2009


      My favorite tool for finding things like this is 
"RSiteSearch.function" in the "RSiteSearch" package.  For the objects 
you mention, I get the following: 


library(RSiteSearch)
hits(a.s <- RSiteSearch.function("auto.stats")) # 0
hits(sx <- RSiteSearch.function("saving.x"))  # 0
hits(rn <- RSiteSearch.function("rain.nyc1")) # 0
hits(s77 <- RSiteSearch.function("state.x77")) # 12
HTML(s77) # View the 12 and find "states" in the "datasets" package. 

hits(ps <- RSiteSearch.function("Phil Spector"))  # 0

     
      If you are still interested in that book, you might write to the 
author, suggesting he might get more readers by providing a package that 
includes those data sets.  If he were really interested in having more 
readers, he might also include script files providing R scripts for 
working all the examples in the book, as Doug Bates does in the "nlme" 
package, which can be found using "system.file('scripts', 
package='nlme')".  These provide R code to work essentially all the 
examples in Pinhiero and Bates (2000) Mixed-Effects Models in S and 
S-Plus (Springer).  For me, those files made reading that book much 
easier, more pleasant and memorable. 


      Hope this helps. 
      Spencer Graves


Douglas Bates wrote:
> On Tue, May 19, 2009 at 2:01 PM, Michael Hannon <jm_hannon at yahoo.com> wrote:
>   
>> Greetings.  I'm trying to learn to program in R.  (I'm definitely NOT new to
>> programming, just to R.)  A colleague suggested that I have a look at the
>> book:
>>
>>    An Introduction to S and S-Plus
>> by:
>>    Phil Spector
>>
>> I've glanced at the book, and it does indeed seem to be the kind of thing I
>> wanted, but in the Introduction to the book, the author says he'll be using
>> several example data sets throughout the book, including:
>>
>>    1. auto.stats
>>
>>    2. saving.x
>>
>>    3. rain.nyc1
>>
>>    4. state.x77
>>
>> The author states:
>>
>>    These data sets should be available as part of the standard
>>    S distribution, so you can simply refer to them as they are
>>    used in the examples.
>>
>> Of course I want to use R, not S.  I have every "R-*" package installed on my
>> Fedora linux system, but I can't find any of the data sets mentioned above.
>> (The command "locate rain.nyc" produces no output, for instance.)
>>     
>
> Not an unreasonable first guess but in R you need parentheses around
> the arguments in function calls and you would need to quote the name
> of the object.  Even when you do those things and guess at the
> function name being find instead of locate you still won't get any
> joy.
>
>   
>> find("rain.nyc")
>>     
> character(0)
>
> The state.x77 data set is part of the datasets package but the others
> never seemed to make it from S to R.  If you want to find out what is
> available you can try
>
> ls.str("package:datasets")
>
> and stare at the output for a while until it begins to make sense.  In
> general, an experienced programmer can learn a lot about the structure
> of an object in R by applying Martin Maechler's str function to it.
> The ls.str function is the equivalent of asking for a listing of the
> objects in a namespace and applying str to each of those names.
>
> Two recent books that I would recommend for learning R are Robert
> Gentleman's "R Programming for Bioinformatics" and John Chambers
> "Software for Data Analysis".  Robert (one of the two "R"'s who
> started the R Project) gives you a broad overview of tools available
> and considerable detail on the important parts.  John, the designer
> and implementor of the S language the preceded R, describes how to
> think about the programming task in R.  Both are worth reading.
>
>   
>> It's entirely possible that these data sets are installed, but I just don't
>> know enough about R to determine that.
>>
>> Hence, I need to help to find out if the data sets are installed, or if they CAN
>> be installed, etc.
>>
>> If you can steer me in the right direction, please do so.
>>
>> Thanks.
>>
>> -- Mike
>>
>> ______________________________________________
>> 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.
>>
>>     
>
> ______________________________________________
> 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