Re: [R] Decimals in R/SQL

2011-04-13 Thread Seth Falcon
On Wed, Apr 13, 2011 at 1:34 PM, Rachel Licata 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

Re: [R] Decimals in R/SQL

2011-04-13 Thread Gabor Grothendieck
On Wed, Apr 13, 2011 at 4:34 PM, Rachel Licata 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 > wo

Re: [R] Decimals in R/SQL

2011-04-13 Thread Rachel Licata
holtman [mailto:jholt...@gmail.com] Sent: Wednesday, April 13, 2011 12:52 PM To: Rachel Licata Cc: r-help@r-project.org Subject: Re: [R] Decimals in R/SQL The problem is that you data is 'integer' and I assume that the database is keeping everything integer. You can do what you are

Re: [R] Decimals in R/SQL

2011-04-13 Thread jim holtman
y( connSQLite , "select ST, > SUM(AGEP*PWGTP)*1.0/SUM(PWGTP)*1.00 as wgtage from ss09 > group by ST") > > ST   wgtage > 1   1 37.57083 > 2   2 33.94322 > 3   4 36.14499 > 4   5 37.51233 > 5   6 35.65581 > > -Original Message- >

Re: [R] Decimals in R/SQL

2011-04-13 Thread Rachel Licata
age- From: jim holtman [mailto:jholt...@gmail.com] Sent: Wednesday, April 13, 2011 12:16 PM To: Rachel Licata Cc: r-help@r-project.org Subject: Re: [R] Decimals in R/SQL You at least have to provide a subset of 'ss09' so we can see what the original data looks like. I have not had

Re: [R] Decimals in R/SQL

2011-04-13 Thread jim holtman
You at least have to provide a subset of 'ss09' so we can see what the original data looks like. I have not had any problems with decimals in using sqldf. > x <- as.data.frame(matrix(runif(100)*100, 10)) > x$key <- sample(1:3, 10, TRUE) > require(sqldf) > xsum <- sqldf(' + select key, sum(V1

[R] Decimals in R/SQL

2011-04-13 Thread Rachel Licata
Hello, When I am writing in sqldf or RSQLite I lose the decimals in my matrix. The only way I can get decimals is by multiplying by 1.0, etc. I have tried manipulating the options, but it is only effective once I multiply by 1.. I appreciate any suggestions! Thanks! Example: z <- s