[R] + and - in RODBC : no longer considered factors
dieter.menne at menne-biomed.de
Wed Apr 30 11:57:22 CEST 2008
I have a large Sweave report that reads data from a database file. Some of
the columns are 1-character strings containing only +, - or NA. An example
for such a table is shown below, and can be downloaded for easier testing
(For security reasons, the file is zipped)
channel = odbcConnectAccess("test.mdb")
ret = sqlQuery(channel,"select * from test")
# 'data.frame': 2 obs. of 2 variables:
# $ hp : num 0 0
# $ hp1: Factor w/ 2 levels "+","a": 2 1
Note that the column hp with "+" and "-" only is read as numeric 0, but
when there is only other character such as in hp1, the conversion occurs.
In R 2.6.2 (or was it an earlier version of RODBC?), column hp was treated
Is this a new feature I have to live with, or an ... ahem ... issue? I know
that with as.is I can get around this, but it need a lot of explicit
programming for the columns I don't want to be as.issed
-- Yes, I know I should have reported this earlier, but the problem of
to re-create the report came up today.
-- Yes, I should have reported this on the windows/devel r-help or directly
to the author (of RODBC; or base?), so I feel guilty in advance that this is
the wrong list.
-- Yes, I have read the NEWS, and could not find something related.
-- Yes, I cannot rule out this is a user error.
R version 2.7.0 (2008-04-22)
attached base packages:
 stats graphics grDevices utils datasets methods base
other attached packages:
More information about the R-help