[R] read.csv.sql() to select from a large csv file
Gabor Grothendieck
ggrothendieck at gmail.com
Sat Dec 1 11:00:24 CET 2012
On Fri, Nov 23, 2012 at 5:05 PM, Juliane Struve
<juliane_struve at yahoo.co.uk> wrote:
> Rui, Anthony, and Gabor,
>
> I got this to work in the end:
>
> for(i in length(Names_EastCoast){
> name <- Names_EastCoast[i]
> sql <- paste("select * from file where ID =
> '",name,"'",sep = "")
> Data <- read.csv.sql("filename",sql = sql)
> }
>
> loops through all individuals in the csv file.
That sets i to the length of Names_EastCoast and then runs the query only once.
I think you want:
for(nam in Names_EastCoast) {
Data <- fn$read.csv.sql("filename",
sql = 'select * from file where ID = "$nam" ')
# ... process Data ...
}
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-help
mailing list