There are many ways to import data from excel spreadsheets into R (see ‘R Tutorial on Reading and Importing Excel Files into R’).
With Hadley Wickham’s recent r-package readxl, it is possible to import large excel files very quickly.
library(readxl) # example 1 mydata <- read_excel("excelfile.xls", sheet = "sheet1") # example 2 mydata <- read_excel("C:/myfiles/excelfile.xlsx", sheet = 1) # example 3 mydata <- read_excel("excelfile.xlsx", sheet = 1, na = "99")
Example 1 loads the sheet sheet1 from excel file named excelfile.xls
The code examples are quite straightforward and easy to understand. The sheet we wish to import maybe specified either as string (the name of a sheet, see example 1) or as integer (the position of the sheet, see example 2).
In case the excel file we wish to import is not located in the current working directory, we need to specify the path to the excel file (see example 2).
Moreover, it is possible to specify a missing value (only one). In example 3, the value 99 will be treated as missing value.
Since the readxl package has been published only very recently, it is rather likely that the author will add some more features in the future.