Java Mailing List Archive

http://www.r-help.com/

Home » Home (12/2007) » R Help for Statistical Computing »

Re: [R] importing excel-file

Hans-Peter

2007-04-20

Replies:

> This is Windows XP, Excel 2003, R 2.4.1.
> Maybe the problem is with Windows XP. I know that it locks some
> files, even when I open for reading. For example, if I open 'test.xls'
> file, then I can't issue the DOS command 'copy test.xls new_test.xls'.

Thanks for your information. Will test sometimes later.


> I added colClasses = "double", and now it works - but I lose all
> strings, that become NAs (they don't matter - maybe if they matter,
> I just have to call read.xls twice). Without colClasses = "double",
> the numbers become meaningless stuff.

If a scalar colClasses argument is given, it will be recycled for all
columns (see help). Thus a character value will be coerced to double
and becomes NA.

I don't understand though what is the matter with teh numbers becoming
meaningless stuff. With:

test9 <- read.xls( filename, sheet = "sheet name", rowNames = FALSE )
# (dateTimeAs argument default, i.e. "numeric")
dateTimeToStr( test9$NumberColumn )

you should get valid numbers (and dates). With
dateTimeAs="isodatetime" there could be localization issues (i.e. the
date time formatting of the cell is not recognized). But I'd need a
test file to say for sure.


--
Regards,
Hans-Peter

______________________________________________
R-help@(protected)
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.
©2008 r-help.com - Jax Systems, LLC, U.S.A.