R Language using Excel FilesINTRODUCTION:This document highlights the process of reading excel files using R language. The...
2ND SOLUTION:install.packages("xlsx")                   [ It can be done manually too. Go to Packages at the              ...
Upcoming SlideShare
Loading in …5
×

R with excel

840 views
744 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
840
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

R with excel

  1. 1. R Language using Excel FilesINTRODUCTION:This document highlights the process of reading excel files using R language. There are severalambiguous suggestions already prevailing in the web. So, we have tried to figure out 2 bestpossible ways to solve the ambiguities. Here, they are described in brief:READING EXCEL FILES:1ST SOLUTION:install.packages("gdata") [ It can be done manually too. Go to Packages at the top. Select any location, preferably USA (CA 1). Then select gdata from the list. ]library(gdata) [ Use of Library for reading an Excel file. ]setwd("D:/R Statistics") [ Set working directory ]y=read.xls("iris.xls") [Read the .xls/.xlsx file that is present in the working directory. ]y [ Print the contents of the excel file. ]
  2. 2. 2ND SOLUTION:install.packages("xlsx") [ It can be done manually too. Go to Packages at the top. Select any location, preferably USA (CA 1). Then select xlsx from the list. ]require(xlsx) [ Ask for xlsx functionalities. ]file=system.file("tests","test_import.xlsx",package ="xlsx") [ “tests” is the name of folder where the xlsx file is saved. “test_import.xlsx” is the xlsx file belonging to the package “xlsx”. Folder, file and package name may be other than these. ]a=read.xlsx(file,1) [ We have to read the file , at the same time mention its sheet no , i.e. 1,2,3…… ]a [ Print the contents of the excel file. ]CONCLUSION:The above mentioned 2 ways are really worth reading an Excel file using R. Writing in an Excelfile using R is still under supervision.

×