Graphics Reference
In-Depth Information
With read.xls() , you can load from other sheets by specifying a number for sheet :
data <- read.xls( "datafile.xls" , sheet = 2 )
Both the xlsx and gdata packages require other software to be installed on your computer. For
xlsx, you need to install Java on your machine. For gdata, you need Perl, which comes as stand-
ard on Linux and Mac OS X, but not Windows. On Windows, you'll need ActiveState Perl. The
Community Edition can be obtained for free .
If you don't want to mess with installing this stuff, a simpler alternative is to open the file in Excel
and save it as a standard format, such as CSV.
See Also
See ?read.xls and ?read.xlsx for more options controlling the reading of these files.
Loading Data from an SPSS File
Problem
You want to load data from an SPSS file.
Solution
The foreign package has the function read.spss() for reading SPSS files. To load data from
the first sheet of an SPSS file:
# Only need to install the first time
install.packages( "foreign" )
library(foreign)
data <- read.spss( "datafile.sav" )
Discussion
The foreign package also includes functions to load from other formats, including:
read.octave() : Octave and MATLAB
read.systat() : SYSTAT
read.xport() : SAS XPORT
read.dta() : Stata
Search WWH ::




Custom Search