X hits on this document

63 views

0 shares

0 downloads

0 comments

7 / 23

DATA OBJECTS IN R

5

R Installation and Administration: Hints for installing R on special plat- forms.

Writing R Extensions: The authoritative source on how to write R pro- grams and packages.

Both printed and online publications are available, the most important ones are ‘Modern Applied Statistics with S’ (Venables and Ripley, 2002), ‘Intro- ductory Statistics with R’ (Dalgaard, 2002), ‘R Graphics’ (Murrell, 2005) and the R Newsletter, freely available from

http://CRAN.R-project.org/doc/Rnews/

In case the electronically available documentation and the answers to fre- quently asked questions (FAQ), available from

http://CRAN.R-project.org/faqs.html

have been consulted but a problem or question remains unsolved, the r-help email list is the right place to get answers to well-thought-out questions. It is helpful to read the posting guide

http://www.R-project.org/posting-guide.html before starting to ask.

1.4 Data Objects in R

The data handling and manipulation techniques explained in this chapter will be illustrated by means of a data set of 2000 world leading companies, the Forbes 2000 list for the year 2004 collected by ‘Forbes Magazine’. This list is originally available from

http://www.forbes.com

and, as an R data object, it is part of the HSAUR package (Source: From Forbes.com, New York, New York, 2004. With permission.). In a first step, we make the data available for computations within R. The data function searches for data objects of the specified name ("Forbes2000") in the package specified via the package argument and, if the search was successful, attaches the data object to the global environment:

R> data("Forbes2000", package = "HSAUR") R> ls()

[1] "Forbes2000" "a"

"book"

"ch"

[5] "refs"

"x"

The output of the ls function lists the names of all objects currently stored in the global environment, and, as the result of the previous command, a variable named Forbes2000 is available for further manipulation. The variable x arises from the pocket calculator example in Subsection 1.2.1.

As one can imagine, printing a list of 2000 companies via

R> print(Forbes2000)

Document info
Document views63
Page views63
Page last viewedMon Jan 16 13:46:24 UTC 2017
Pages23
Paragraphs684
Words5996

Comments