Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

read excel in r

#readxl Package
library(readxl)
##Read sheet One by One
read_excel("data.xlsx", sheet = 1,
          col_names = c("x", "y"), #Default col_names = T
          col_types = NULL, #Null means R will guess the type itself, 
           					#it can also take "text", "numeric", "date", "blank"
          skip = 0)

##All
lapply(excel_sheets("data.xlsx"), 
       read_excel,
       path = "data.xlsx")

##Getting Sheets name
excel_sheets("data.xlsx")

#gdata Package
##Default for xls file type only
##Require extra modules to read xlsx files
library(gdata)
read.xls("data.xls", sheet = 2)

### All sheet argument within this document could be also susbstituted with sheets' name
 
PREVIOUS NEXT
Tagged: #read #excel
ADD COMMENT
Topic
Name
3+6 =