On Fri, Nov 23, 2012 at 5:05 PM, Juliane Struve
<juliane_str...@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

______________________________________________
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.

Reply via email to