Yu-Ling Wu <yuling5 at yahoo.com> writes:
> Hi,
>
> I'd like to pass a string to a function as the value
> of the argument.
> Here is my code. However, it doesn't work. Please help
> me with this.
>
> Thanks,
> Yu-Ling Wu
> -----------------------------------------------------
> library(RODBC)
> odbcConnect("console") -> myConnect
>
> fun1 <- function(dd1) {
> h3 <- sqlQuery(myConnect, "select * from console where
> byday = 'dd1'group by by hour")
> }
>
> fun1('010122')
> print(summary(h3)
Passing the string is not your problem. Getting it into the middle of
the select string is. Try something like.
paste("select * from console where byday =", dd1, "group by
hour")
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._