read.xls.html
3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Read Excel files</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../R.css">
</head><body>
<table width="100%" summary="page for read.xls {gdata}"><tr><td>read.xls {gdata}</td><td align="right">R Documentation</td></tr></table>
<h2>Read Excel files</h2>
<h3>Description</h3>
<p>
Reads a Microsoft Excel file into a data frame
</p>
<h3>Usage</h3>
<pre>
read.xls(xls, sheet=1, verbose=FALSE, ..., perl="perl")
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>xls</code></td>
<td>
name of the Microsoft Excel file</td></tr>
<tr valign="top"><td><code>sheet</code></td>
<td>
number of sheet within the Excel file from which data are
to be read</td></tr>
<tr valign="top"><td><code>verbose</code></td>
<td>
logical flag indicating whether details should be
printed as the file is processed.</td></tr>
<tr valign="top"><td><code>perl</code></td>
<td>
name of the perl executable to be called.</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
additional arguments to read.table. The defaults of
read.csv are used.</td></tr>
</table>
<h3>Details</h3>
<p>
This function works translating the named Microsoft Excel file into a
temporary .csv file, using Greg Warnes' xls2csv Perl script (installed
as part of the gregmisc package).
</p>
<p>
Caution: In the conversion to csv, strings will be quoted. This can be
problem if you are trying to use the <code>comment.char</code> option of
<code>read.table</code> since the first character of all lines (including
comment lines) will be """ after conversion.
</p>
<h3>Value</h3>
<p>
a data frame</p>
<h3>Note</h3>
<p>
Either a working version of Perl must be present in the executable
search path, or the exact path of the perl executable must be provided
via the <code>perl</code> argument. See the examples below for an illustration.
</p>
<h3>Author(s)</h3>
<p>
Jim Rogers <a href="mailto:james.a.rogers@pfizer.com">james.a.rogers@pfizer.com</a>, modified
and extended by Gregory R. Warnes <a href="mailto:warnes@bst.rochester.edu">warnes@bst.rochester.edu</a>.
</p>
<h3>References</h3>
<p>
http://www.analytics.washington.edu/statcomp/downloads/xls2csv
</p>
<h3>See Also</h3>
<p>
<code><a href="../../base/html/read.csv.html">read.csv</a></code>
</p>
<h3>Examples</h3>
<pre>
# iris.xls is included in the gregmisc package for use as an example
xlsfile <- file.path(.path.package('gdata'),'xls','iris.xls')
xlsfile
iris <- read.xls(xlsfile)
head(iris) # look at the top few rows
## Not run:
# Example specifying exact Perl path for default MS-Windows install of
# ActiveState perl
iris <- read.xls(xlsfile, perl="C:\perl\bin\perl.exe")
# Example specifying exact Perl path for Unix systems
iris <- read.xls(xlsfile, perl="/usr/bin/perl")
## End(Not run)
</pre>
<hr><div align="center">[Package <em>gdata</em> version 2.3.1 <a href="00Index.html">Index]</a></div>
</body></html>