[R] create string of comma-separated content of vector
jason.law at BES.CI.PORTLAND.OR.US
Wed May 20 01:43:18 CEST 2009
x <- 0:10
See ?sQuote for cases where the vector is a character and needs to be quoted.
City of Portland
Bureau of Environmental Services
Water Pollution Control Laboratory
6543 N Burlington Avenue
Portland, OR 97203-5452
jason.law at bes.ci.portland.or.us
> how do I create a string of the comma-separated content of a vector?
> I've got the vector i with several numeric values as content:
> num 99
> and want to create a SQL statement to look like the following where
> the part '(2, 4, 6, 7)' should be
> the content of the vector i:
> select * from [biomass_data$] where site_no in (2, 4, 6, 7)
> Here my approach (which doesn't work):
> site_all_data <= sqlQuery(channel, "select * from [biomass_data$]
> where site_no in (",paste(i,sep=","),") )
> sorry for spaming so much today to the mailing list...
> Time flies like an arrow, fruit flies like bananas.
More information about the R-help