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,
condition,
"group by year,month,ori",
"order by year,ori"))
...
}
and it is run like:
data.youth <- getData("murdyouth"," and offage <= 24
",
whatTotal="sum(vctcnt*wtus)")
Have a nice day,
Matej
--
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