[R] RODBC connection - mixed data types

Petr Pikal petr.pikal at precheza.cz
Tue Aug 14 17:16:01 CEST 2001


Dear R users

I use R (1.3.0) Windows version usually with connection to Excel 
sheets via RODBC Version: 0.8-2. Everything is OK until I use mixed 
data types (numeric and character) in one column.

In that case I will get a particular column of data frame with NA's.

Example

vzorek   	lpas  	apas  
NA 	51.240 	20.26 
NA 	51.340 	20.42 
NA 	49.770 	22.05 
RB 12 	49.840 	19.30 
RB 12 	49.880 	19.32

But in actual Excel sheet instead of NA values were numbers 11 
(numeric). I can modify elevens in Excel as let say RB 11 or 
something like that, but if there are more such columns and many 
different values it can be quite complicated.

The values are either considered character, converted to factor and 
numeric values are changed to NA or numeric and character values 
are converted to NA.

> is.factor(pigment[,1])
[1] TRUE
> is.numeric(pigment[,2])
[1] TRUE
> is.numeric(pigment[,3])
[1] TRUE

I tried parameter as.is but it did not help and I did not find any clue 
other then I(....) but I can not resolve how to use it in that case.

Is there any possibility how to handle different data types in one Excel 
sheet column directly by using ODBC connection and keep all values 
in such column as they are when moving data from Excel to R?

Thank you.
Petr Pikal
Precheza a.s.
Nabr.Dr.E.Benese 24
tel: 00420 641 25 2257
     +420 (0)724 008 364
     petr.pikal at precheza.cz
     p.pik at volny.cz

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list