[R] OpenOffice ods spreadsheets in R?
Martin Rittner
kmr at thegeologician.net
Sun Jul 10 12:59:47 CEST 2011
David, you are right, I seem not to be able to reproduce the problem
with a synthetic file see attached). However, if I run
tst<-read.ods(file="test.ods",stringsAsFactors=FALSE)
I do not get a data.frame() in tst[[1]], just a vector of the row names:
1> tst[[1]]
[1] NA "row1" "row2" "row3" "row4" "row5"
I tried to reproduce the "messy" structure of the original file, which
is not my fault but how I got the data... Sorry, I can't post the file
that actually causes my problems, as it contains all my most important
(unpublished) research data... And I don't want to spend hours on
finding the exact table lines in many thousands that reproduce the
problem, sorry.
Anyway, I'll go with the less satisfying solution of exporting all the
sheets as .csv (as proposed by Ista and Don, thanks) and see how that
goes, just thought there was another solution.
Richard, thanks for the tip, I didn't try it, but as far as I can see,
it's supposed to run R within OpenOffice? That's not quite what I had in
mind, I am using R on different machines and don't want to have to
install OpenOffice on each and open it up each time I want to work on
the data...
Thanks to everyone for the quick and detailed reply!
Martin
On 10/07/11 02:13, David Winsemius wrote:
>
> On Jul 9, 2011, at 8:49 PM, Martin Rittner wrote:
>
>> I would like to open OpenOffice (LibreOffice) .ods files in R. I've
>> tried the ROpenOffice package from omegahat, but unfortunately, the
>> read.ods() function attempts to use the values of the first column in
>> a worksheet as row names, and thus does not allow duplicates in there
>> (which, even more unfortunately, occur in my files). Also, the
>> function does not allow to forward any other parameters to the called
>> functions, like e.g. row.names=FALSE.
>> Another option read.ods() does not offer is choice of the worksheet(s)
>> to open, but that's a minor issue for me.
>>
>> Now, I could alter the files to fit the function. I could alter the
>> function itself. But before I do any of that, I wanted to ask if
>> someone has a better idea, another approach to ods-files altogether,
>> maybe?
>>
>
> I'm not getting the same results as you. Duplicates in the first column
> do not seem to be causing problems. If you look at the cod for read.ods,
> you can step through it and modify its behavior to you liking. Perhaps
> you should post a reproducible example and also the error messages you
> are getting.
>
More information about the R-help
mailing list