[R] + and - in RODBC : no longer considered factors

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
Date: Wed, 30 Apr 2008 11:57:22 +0200

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 from


(For security reasons, the file is zipped)

table test

hp	hp1
+	a
-	+

channel = odbcConnectAccess("test.mdb")
ret = sqlQuery(channel,"select * from test") odbcClose(channel)

# '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 as factor.

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.


R version 2.7.0 (2008-04-22)

LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=Germ an_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] RODBC_1.2-3

R-help_at_r-project.org mailing list
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. Received on Wed 30 Apr 2008 - 10:31:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Apr 2008 - 11:30:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive