Re: [R] Getting frustrated with RMySQL

2008-10-15 Thread repkakala Gazeta.pl
Neat? It mihgt be very usefull, but it's rather a dirty hack in a dirty language than a 'neat' solution. \misiek > That is neat Gabor. Thanks, Ted > Gabor Grothendieck wrote: > > The gsubfn package can do quasi perl-style interpolation by > prefacing any function call with fn$. > > library(gs

Re: [R] Getting frustrated with RMySQL

2008-10-14 Thread Gabor Grothendieck
Its been pointed out to me that there is a bug in gsubfn that occurs when a variable named x is used so the example below will not work correctly. It seems it clashes with an internal variable also called x. In the meantime use a different variable name such as X. library(gsubfn) X <- 3 fn$dbGet

Re: [R] Getting frustrated with RMySQL

2008-10-14 Thread Ted Byers
That is neat Gabor. Thanks, Ted Gabor Grothendieck wrote: > > The gsubfn package can do quasi perl-style interpolation by > prefacing any function call with fn$. > > library(gsubfn) > x <- 3 > fn$dbGetQuery(con, "select * from myTable where myColumnA = $x and > MyColumnB = `2*x` ") > > See ht

Re: [R] Getting frustrated with RMySQL

2008-10-14 Thread Ted Byers
Thanks Jeffrey and Barry, I like the humour. I didn't know about xkcd.com, but the humour on it is familiar. I saw little Bobby Tables what seems like eons ago, when I first started cgi programming. Anyway, I recognized the risk of an injection attack with this use of sprint, but in this case,

Re: [R] Getting frustrated with RMySQL

2008-10-14 Thread Gabor Grothendieck
The gsubfn package can do quasi perl-style interpolation by prefacing any function call with fn$. library(gsubfn) x <- 3 fn$dbGetQuery(con, "select * from myTable where myColumnA = $x and MyColumnB = `2*x` ") See http://gsubfn.googlecode.com On Tue, Oct 14, 2008 at 5:32 PM, Jeffrey Horner <[EMA

Re: [R] Getting frustrated with RMySQL

2008-10-14 Thread Jeffrey Horner
Barry Rowlingson wrote on 10/14/2008 04:40 PM: 2008/10/14 Jeffrey Horner <[EMAIL PROTECTED]>: I've found the best way to parameterize is using R's sprintf function. For instance, the following query not only parameterizes the variable position, but also the table name: fields <- dbGetQuery(co

Re: [R] Getting frustrated with RMySQL

2008-10-14 Thread Barry Rowlingson
2008/10/14 Jeffrey Horner <[EMAIL PROTECTED]>: > I've found the best way to parameterize is using R's sprintf function. For > instance, the following query not only parameterizes the variable position, > but also the table name: > > fields <- dbGetQuery(con,sprintf("select field,elem_label from %

Re: [R] Getting frustrated with RMySQL

2008-10-14 Thread Jeffrey Horner
Ted Byers wrote on 10/14/2008 02:33 PM: Getting the basic stuff to work is trivially simple. I can connect, and, for example, get everything in any given table. What I have yet to find is how to deal with parameterized queries or how to do a simple insert (but not of a value known at the time t