Re: [R] Sampling from a Postgres database

2010-01-15 Thread Joe Conway
On 01/15/2010 01:49 AM, Bart Joosen wrote: > > One way could be to first select only the unique ID's, sample this and then > select only the relevant records: > > strQuery = "SELECT ID from tblFoo;" > IDs <- sqlQuery(channel, strQuery) > sample.IDs <- sample(IDs,10) > strQuery = paste("SELECT ID

Re: [R] Sampling from a Postgres database

2010-01-15 Thread Bart Joosen
One way could be to first select only the unique ID's, sample this and then select only the relevant records: strQuery = "SELECT ID from tblFoo;" IDs <- sqlQuery(channel, strQuery) sample.IDs <- sample(IDs,10) strQuery = paste("SELECT ID from tblFoo WHRE ID IN(", sample.IDs, ");") IDs <- sqlQuery

[R] Sampling from a Postgres database

2010-01-14 Thread christiaan pauw
Hi Everybody Is there a way in which one can use the RPostgreSQL package to take a sample from a table in Postgres database without having to read the whole table into R regards Christiaan [[alternative HTML version deleted]] __ R-help@r-proje