Re: [R] Interpolating variables within (RODBC library) SQL statements for MySQL

2009-05-25 Thread Gabor Grothendieck
x <- 1; y <- 2 # 1 paste("x is", x, "y is", y) # 2 sprintf("x is %d, y is %d", x, y) # 3 library(gsubfn) fn$cat("x is $x, y is $y\n") For the last one see http://gsubfn.googlecode.com If we preface a function by fn$ then it interpolates strings subject to some qualifications, e.g. fn$sqlQuery(

Re: [R] Interpolating variables within (RODBC library) SQL statements for MySQL

2009-05-25 Thread jim holtman
?paste e.g., sql <- paste("select YPOS, XPOS, YEAR, MONTH, RANGE, APFEL,", "TEMPMIN, TEMPAVG, TEMPMAX, PRECIPITATION, SUNDURATION from DATA where YPOS=", ypos, " AND XPOS=", xpos, " AND MONTH BETWEEN 1 AND 12 AND RANGE = 1;", sep="") On Mon, May 25, 2009 at 4:26 PM, John Fitzgerald < joh

[R] Interpolating variables within (RODBC library) SQL statements for MySQL

2009-05-25 Thread John Fitzgerald
Hi everyone, I am desperately looking for a method to interpolate strings within an SQL statement as follows: I get a lot of rows out of a database (in my example POSITION_to_ZIPCODE Database with holds records for German ZIP Code <--> Gauss-Krueger Coordinate System ) and want this to be selecte