Hi everyone, I am using the sqlQuery function (in RODBC library) to import data from a database into R. My table (called temp) in the database looks like this: category numabc 54469517.307692307692def 36428860.230769230769 I used the following R code to pull data into R:data <-sqlQuery(channel, "select category, num from temp;") However, the result is that "num" gets all its decimal places chopped off, so "data" looks like this instead in R:category numabc 54469517def 36428860
I've tried various alternative approaches, but none have fixed the problem. When I cast the variable to a numeric type like this (data <-sqlQuery(channel, "select category, num::numeric from temp;"), it still gave me the same result. Casting to a real type like this (data <-sqlQuery(channel, "select category, num::real from temp;") resulted in scientific notation that also rounded the numbers. Any suggestions? Much appreciated! [[alternative HTML version deleted]] ______________________________________________ R-help@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.