[R] Re: problem in long select from RODBC

Matej Cepl cepl at surfbest.net
Fri Jun 18 17:43:20 CEST 2004

On Wednesday 16 of June 2004 14:42, Wolski wrote:
> sqlQuery(channel, "select dir, c \
>  from firsthit3 \
>  where dir LIKE \"%SCHULEN%\"")

Another option is paste(). This works for me (selectedCities is a constant 
set outside of this function):

	getData <- function(var,condition,whatTotal="sum(vctcnt)") {
	    temp <- sqlQuery(pg,paste(
	        "select year, month, ori, ", whatTotal," as total",
	        "from victims where ori in ",selectedCities,
	        "group by year,month,ori",
	        "order by year,ori"))

and it is run like:

	data.youth    <- getData("murdyouth"," and offage <= 24 ",

Have a nice day,


Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
The state is the great fictitious entity by which everyone seeks
to live at the expense of everyone else.
      -- Frederick Bastiat

More information about the R-help mailing list