Sunday 2 August 2015

R : Reading xls sheet data

“gdata” package provides functions to read xls sheets.

Step 1: Install gdata package
Open R console and type following command.

install.packages("gdata")

Step 2: Load the package
library(gdata)

Step 3: Use the following command to read xls sheet.

> data <- read.xls("names.xls")
> 
> data
  firstName lastName
1    Tushar      abc
2     Sunil    Kumar
3   Sankalp    Dubey
4   Phalgun Garimela

Note
You can read specific sheet by specifying sheet number like following.
data <- read.xls("datafile.xls", sheet=2)



Prevoius                                                 Next                                                 Home

No comments:

Post a Comment