Re: [R] sqldf package: using variables in where condition
On Mon, Jan 14, 2013 at 8:36 AM, Ravi Sreedhar wrote: > > > Sent from my iPhone > > On Jan 13, 2013, at 9:47 PM, ravsre wrote: > >> I am trying to use the sqldf package to create independent data frames from a >> master dataframe. >> I want to use sqldf package and perform a simple select statement. However, >> what I want to do is to create a loop and repeatedly send a variable to the >> where clause condition such as a: select * from mydfrm where Symbol = >> list[i] >> The 'list' is another data frame with a single column with 15 values. All I >> what to do is to create loop for i in 1:15 and pass on into the select >> statement as list[1], list[2 }..tile list[15] >> >> Can someone help since, I am unable to reference the element location as >> variable in the sqldf function? >> See Example 5 on the sqldf home page. http://code.google.com/p/sqldf/#Example_5._Insert_Variables -- 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.
Re: [R] sqldf package: using variables in where condition
Sent from my iPhone On Jan 13, 2013, at 9:47 PM, ravsre wrote: > I am trying to use the sqldf package to create independent data frames from a > master dataframe. > I want to use sqldf package and perform a simple select statement. However, > what I want to do is to create a loop and repeatedly send a variable to the > where clause condition such as a: select * from mydfrm where Symbol = > list[i] > The 'list' is another data frame with a single column with 15 values. All I > what to do is to create loop for i in 1:15 and pass on into the select > statement as list[1], list[2 }..tile list[15] > > Can someone help since, I am unable to reference the element location as > variable in the sqldf function? > > also, is there a better way? > would appreciate your help > > Rgds, Ravi > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/sqldf-package-using-variables-in-where-condition-tp4655445.html > Sent from the R help mailing list archive at Nabble.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.