On 11/29/2007 7:03 AM, Søren Højsgaard wrote: > Dear list, > I have a rather large dataset in SAS which I export to a SQLite database for > subsequent use in R. > > One of the columns is > cowidp > 1881501224.2 > 1881501224.2 > > and the column is stored as a character in SAS. It becomes a varchar in the > database (it should be - it is an identifier; not a number). Reading this > into R gives > cowidp > 1 1881501224 > 2 1881501224 > .... > - i.e. the ".2" is stripped off - and it becomes a numeric variable > > However, if I store replace "." with "_" in my SAS data then the column in my > database is > > cowidp > 1881501224_2 > 1881501224_2 > > Reading into R gives > cowidp > 1 1881501224_2 > 2 1881501224_2 > > as it "should be" - it becomes a factor > > Is the fact that the "."-part does not seem to work a bug in sqlQuery (or > somewhere else) or is it the intention that things containing a "." are > converted into numeric values if possible?
If you're using sqlQuery from RODBC, then the as.is argument of sqlGetResults is relevant. It defaults to FALSE, and tries to convert things based on how they look. Duncan Murdoch ______________________________________________ [email protected] 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.

