Skip to content

output

3 messages · Val, Marc Schwartz, Rolf Turner

Val
#
Hi Marc and all,

Last time you suggest me to use  WriteXLS  function to write more than
65,000  row in excel.  Creating the file worked fine.  Now I wanted to
read it using the WriteXLS   function but have a problem,. The file
has more than  one sheets.  Here is the script and the error message.

datx <- function(n,mean,sd) { mean+sd*scale(rnorm(n)) }
dat <-data.frame(datx(110000,10,2))
WriteXLS(dat, "test5.xlsx", row.names=FALSE)
 I created several sheets  by copying the first sheet

t1<- read.xls("Test6.xlsx",2, stringsAsFactors=FALSE)

I am getting an error message of
Error in read.table(file = file, header = header, sep = sep, quote = quote,  :
  no lines available in input

Thank you in advance
On Tue, Dec 13, 2016 at 5:07 PM, Val <valkremk at gmail.com> wrote:
#
Hi Val,

Presuming that the Excel file that you are trying to read has a second worksheet, which is what the read.xls() command you are using is trying to do, the problem may be that XLSX file support has not been installed for the gdata package, which is what I presume you are using. You do not explicitly indicate that, so I am guessing here.

In case there is any misunderstanding, I do not have any support for reading Excel files in WriteXLS.

If you look at the help for ?read.xls in Greg's gdata package, there is a reference to using ?xlsFormats, which tests as to whether or not you have support for XLSX formats installed for that package. If that latter function only returns "XLS" and not both "XLS" and "XLSX", then you need to use ?installXLSXsupport to install additional Perl modules so that Greg's functions can read XLSX format files.

Alternatively, there are other Excel file I/O packages available on CRAN if you would prefer to consider other options as well. They will typically require Java being installed, rather than Perl, as I and Greg do.

Regards,

Marc
#
On 18/01/17 10:28, Marc Schwartz wrote:
<SNIP>
The read_excel() function from the "readxl" package has an argument 
"sheet" which should facilitate what Val wants to do.

In my experience the read_excel() function (which is, as you indicate, 
Java rather than Perl based) is quite a bit faster than the Perl based 
alternatives.

cheers,

Rolf Turner