Research Breakthrough Possible @S-Logix pro@slogix.in

Office Address

Social List

How to Read and Write an Excel File in R?

Description

To Read and Write an Excel File using R programming.

Process

   R Package :xlsx

   R Package : openxlsx -- for big excel file.

   R Function to read : xlsx()

   R Function to write : xlsx()

Sapmle Code

#Reading Excel File

#Get and Set Working Directory
print(getwd())
setwd(“/home/soft13”)
getwd()

#Read file from Excel
#install.packages(“xlsx”)
library(“xlsx”)
dataSet<-read.xlsx(“ExcelReadData.xlsx”,sheetIndex=1)
print(dataSet)
View(dataSet)

#Write data into an Excel File
readData<-read.xlsx(“ExcelWriteData.xlsx”,sheetIndex=1)
write.xlsx(readData,”ExcelOutput.xlsx”,append=FALSE)

Screenshots
Read an Excel File in R
Write an Excel File in R