Re: [R] Decimals in R/SQL

From: Seth Falcon <seth_at_userprimary.net>
Date: Wed, 13 Apr 2011 14:27:28 -0700

On Wed, Apr 13, 2011 at 1:34 PM, Rachel Licata <RachelL_at_kff.org> wrote:

> Thanks again Jim - that is really helpful and I apologize that I am
> new to R.  How can I convert to numeric in SQL and when I am working
> on a table in a database?  The file is huge so that is why I am
> using SQL and the database to work through it.

I believe that RSQLite will do the right thing if you provide the correct types in your schema. So for a new database, you want to make sure that the columns that you want to be numeric are created like:

    CREATE table sometable (my_data REAL);

You should be able to create a new table from an existing table using SQL where the new table has the types you want.

+ seth

-- 
Seth Falcon | @sfalcon | http://userprimary.net/

______________________________________________
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 13 Apr 2011 - 21:29:38 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 13 Apr 2011 - 22:30:30 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