Excel is a spreadsheet application developed by Microsoft to be run on Windows and Mac OS, which has a similar function to R for performing statistical computation, graphical visualization, and data modeling. Excel is provided by Microsoft with the Microsoft Office bundle, which mainly supports .xls
spreadsheet data file format. In case, we want to read or write to Microsoft Excel spreadsheets from within R, we can use many available R packages. But one of the popular and working R library is xlsx.
This package programmatically provides control of the Excel files using R. The high level API of this allows users to read a spread sheet of the .xlsx
document into a data.frame
and writing data.frame
to a file. This package is basically developed by Adrian A. Dragulescu.
Here, we are considering the .xls
file as the data source, which can be built and maintained with the help of Microsoft Excel 97/2000/XP/2003.
The following are the prerequisites for the xlsx packages:
Installing xlsxX packages:
Suppose we have created one excel file and now we want to perform the data analytics related operations with R, this is the best package to load the excel file to be processed within R.
es <- read.xlsx("D:/ga.xlsx",1)
The preceding command will store the excel data with sheet 1 into the es
dataframe format in R.