Most data sharing in organizations is done using Microsoft Excel. So the code to import Excel data into R for manipulation is a good thing to know. The import function is powerful enough to let you read a specific section of an Excel file and load it into a dataframe..
Here is the sample code.
mydata <- read.xlsx("file.xlsx",sheetIndex=1,colIndex=7:15, rowIndex=18:23)
The sample code reads an Excel file and imports data from columns 7 to 15 and rows 18 to 23 into a dataframe. An R dataframe is a table of data.
Here is the sample code.
mydata <- read.xlsx("file.xlsx",sheetIndex=1,colIndex=7:15, rowIndex=18:23)
The sample code reads an Excel file and imports data from columns 7 to 15 and rows 18 to 23 into a dataframe. An R dataframe is a table of data.
No comments:
Post a Comment