Rでエクセルファイルを読み込む
Rでエクセルファイルを読み込む方法をメモっておく。シートの指定は名前ではなく番号らしい。
library(gdata) dat <- read.xls("data.xlsx", sheet = 1)
Fortunately, the files can be read with the gdata package, using the read.xls() function. This will read files in either the .xls or the .xlsx format.
library(gdata)
ffdata = read.xls("http://www.math.smith.edu/r/data/help.xlsx",
sheet=1)In this implementation, you specify the sheet by number, rather than name. This may be less precise than using the full name, but it does spare some tedious typing.
SAS and R: Example 8.37: Read sheets from an excel file
追記(2012/08/07):read.xls関数を使って読み込むためには、Perlが必要らしい。Windowsをインストールする際にいつもPerlも入れているから、気づかなかった。