Message-ID: <b59a37130905191103j43029838ged73a6809e3bf61c@mail.gmail.com>
Date: 2009-05-19T18:03:12Z
From: Mark Wardle
Subject: create string of comma-separated content of vector
In-Reply-To: <dd40a8b0905190924r5850dee0oe8e5cb518a239bc9@mail.gmail.com>
see ?paste
e.g.
x <- seq(0,10,1)
paste(x, collapse=", ")
2009/5/19 Katharina May <may.katharina at googlemail.com>:
> Hi,
>
> 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:
>>str(i)
> 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...
>
> -Katharina
>
> --
> Time flies like an arrow, fruit flies like bananas.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK