[R] error reading xlsm file with read.xls

David Winsemius dwinsemius at comcast.net
Thu Dec 6 00:47:23 CET 2012


On Dec 5, 2012, at 2:19 PM, David Winsemius wrote:

> 
> On Dec 4, 2012, at 10:05 AM, Sebastian Kruk wrote:
> 
>> Dear all,
>> 
>> I cannot reading a .xlsm file using read.xls.
>> 
> 
> That doesn't surprise me. It's a macro format. Why should R be reading Excel macros?
> 
> 
>> I executed:
>> 
>> read.xls("resultados.xlsm",
>> colNames = TRUE,
>> sheet = 1,
>> type = "data.frame",
>> from = 1,
>> rowNames = NA,
>> colClasses = "character",
>> checkNames = TRUE,
>> dateTime = "numeric",
>> naStrings = NA,
>> stringsAsFactors = F)

The other point I would make is that you should be looking at the help page for read.xls and making sure that on the off-chance that the authors did intend for you to have access to Excel macros for some readsin in R tha thtey were using the same aruments. The error message says you are having problems with you argument list and looking at the help page makes me think you are using read.tabe arguments for read.xls. Not a wise idea.This is the list of formals:

read.xlsx(file, sheetIndex, sheetName=NULL, rowIndex=NULL,
  colIndex=NULL, as.data.frame=TRUE, header=TRUE, colClasses=NA,
  keepFormulas=FALSE, encoding="unknown", ...)

And it says the 'dots' are sent to data.frame rather than to read.table.

>> Error:
>> 
>> Call("ReadXls", file, colNames, sheet, type, from, rowNames, :
>> Incorrect number of arguments (11), expecting 10 for 'ReadXls'
>> If I just write
>> 
>> read.xls("resultados.xlsm")
>> It give me the same error.
> 
> -- 
> 
> David Winsemius, MD
> Alameda, CA, USA
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list