[R] xlsx problem

Steven McKinney smckinney at bccrc.ca
Tue Mar 29 03:16:02 CEST 2011


Dear Christoph

Are there formulas in any cells of sheet 6?

One thing you might try is to open up the spreadsheet in Excel and create a new sheet,
call it Sheet 7.

In Sheet 6, select all the cells with data (or just click the
upper left icon at the border of the spreadsheet that selects the whole
sheet, <Control>-a will also do this), then go to sheet 7 and
do a Paste Special - Values

If you just paste the values, then save the file and read Sheet 7, does that work?


While you're in the spreadsheet, see if you can spot any odd looking entries on sheet 6.
Excel lets people put just about anything, just about anywhere.

Steven McKinney
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Martin Knapp [mkna005 at aucklanduni.ac.nz]
Sent: March 28, 2011 1:43 PM
To: r-help
Subject: [R] xlsx problem

Dear list,
I'm running windows xp with R 2.12.0. I'm trying to load a excel
spreadsheet into R using the xlsx package. I posted my code below with
the error I get.

> res <- read.xlsx("Copy of test_excel_input_data.xlsx", 6)
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  :
  java.lang.IllegalStateException: Cannot get a numeric value from a text cell

There are 6 sheets in that file. 5 of them are read into a dataframe
without problem. For the 6th one(the one I actually need) I get this
error message.
There is obviously something in the format of the sheet wrong. Has
anyone an idea whats going wrong and what I have to change in the
sheet?

Thanks in advance,

Christoph

______________________________________________
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.



More information about the R-help mailing list