[R-sig-DB] query result precision

William Morris wkmor1 @end|ng |rom gm@||@com
Mon May 12 05:15:16 CEST 2008


In R, using RSQLite, I get a maximum of 4 digits after the decimal  
point for every value returned from a query, whereas the same select  
statement executed with 'sqlite3' (at the command line) gives each  
value without rounding. How can I get R to give the same output?

Cheers in advance,

Will.

in R

 > m <- dbDriver("SQLite")
 > con <- dbConnect(m,"database.sqlite")
 > rs <- dbSendQuery(con,"select col1 from table1 limit 10")
 > fetch(rs,n=-1)
    col1
1   145.0836
2   145.0836
3   145.0836
4   145.0836
5   145.0836
6   145.0836
7   144.0681
8   144.0681
9   144.0681
10  144.0681

in sqlite3

sqlite> select col1 from table1 limit 10;
145.08361
145.08361
145.08361
145.08361
145.08361
145.08361
144.06806
144.06806
144.06806
144.06806

R session info

sessionInfo()
R version 2.7.0 Patched (2008-05-10 r45665)
i386-apple-darwin8.10.1

locale:
en_AU.UTF-8/en_AU.UTF-8/C/C/en_AU.UTF-8/en_AU.UTF-8

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

other attached packages:
[1] RSQLite_0.6-8 DBI_0.2-4

loaded via a namespace (and not attached):
[1] tools_2.7.0




More information about the R-sig-DB mailing list