[R] open xlsx file using read.xls function of gdata package

Luigi Marongiu marongiu.luigi at gmail.com
Fri Apr 3 20:24:29 CEST 2015

Dear all,
I am trying to open excel files using the gdata package. I can do that
using a .xls file, but the same file, containing the same data,
formatted in .xlsx gives error (R does not recognize the pattern from
where to start reading the data).
Doen anybody knows whether it is possible to read .xlslx with this package?
Am I missing another package to implement the reading of the .xlsx?
Thank you

PS: this is the error I get:
> my.file <- "array.xlsx"
> my.data<-read.xls(
+       my.file,
+       sheet="sheet x",
+       verbose=FALSE,
+       pattern="row name",
+       na.strings=c("NA","#DIV/0!"),
+       method="tab",
+       perl="perl"
+     )
> Warning message:
In read.xls(my.file, sheet = "sheet x", verbose = FALSE,  :
  pattern not found

The verbose version runs like this:
to tab  file

Executing ' '/usr/bin/perl'
 'array.xlsx' '/tmp/Rtmp2tAjzz/filef06102dd018.tab' 'sheet x' '...

Loading 'array.xlsx'...

Orignal Filename: array.xlsx
Number of Sheets: 2

Writing sheet 'sheet x' to file '/tmp/Rtmp2tAjzz/filef06102dd018.tab'
Minrow=31 Maxrow=17310 Mincol=0 Maxcol=4
  (Ignored 0 blank lines.)



Searching for lines tfntaining pattern  row name ...
Warning message:
In read.xls(my.file, sheet = "sheet x", verbose = TRUE,  :
  pattern not found

More information about the R-help mailing list