I switched to libreoffice for my spreadsheets, but I noticed an error when importing an xls file modified with libreoffice inside R using the gdata package's read.xls() function. If a column is formatted as General, then once in R the cells display General instead of the right value.
To fix it I need to format every column to the proper format (number, text, etc), which i'd prefer to avoid since general better manage formatting (eg. automatically display the right number of significant digits).
Any better solution?
SOLVED:
After suggestion by RockScience I tried openxlsx:read.xlsx()
and it works perfectly. Is even faster and less error prone than gdata:read.xls()
!
I have also noticed that
gdata::read.xls
doesn't evaluate the formula, but instead just imports what is displayed in excel. So for instance if a formula returns 1.0002 but in excel the display is limited to 2 digits,gdata::read.xls
will only import 1.00I have looked at several ways of importing xls data into R:
As you see
gnumeric::read.gnumeric.sheet
does evaluate the formula, so I suggest you try this (but it needs access to the gnumeric command line which is not available easily on Windows)since recently there is also a new package http://cran.r-project.org/web/packages/openxlsx/index.html which seems very promissing.