RE: [R] string syntactic sugar in R? - long post

2005-05-11 Thread Brahm, David
charles loboz [EMAIL PROTECTED] wrote: A gstring is a string with variable names embedded and replaced by values(converted to strings, lazy eval) before use. I use the following function, which will take variables either from named arguments or from the environment. It also concatenates all

Re: [R] string syntactic sugar in R? - long post

2005-05-07 Thread Robert Gentleman
Hi, In Bioconductor, we have something called copySubstitute, which does what you want, I believe, x=select @var1@ from @tab1@ copySubstitute(textConnection(x), symbolValues= list(var1=Race, tab1=ReallyBigTable), dest=stdout()) yields select Race from ReallyBigTable you can read in from

Re: [R] string syntactic sugar in R? - long post

2005-05-07 Thread James Bullard
The other thing to use is 'sprintf', which would be fantastic in R if it imputed types based on the format string. As it is now, for your query you would do: sprintf(SELECT %s FROM table WHERE date = '%s', column, 2005-10-12) [1] SELECT column FROM table WHERE date = '2005-10-12' Which, in my

Re: [R] string syntactic sugar in R? - long post

2005-05-07 Thread Ted Harding
On 07-May-05 James Bullard wrote: The other thing to use is 'sprintf', which would be fantastic in R if it imputed types based on the format string. As it is now, for your query you would do: sprintf(SELECT %s FROM table WHERE date = '%s', column, 2005-10-12) [1] SELECT column FROM table

Re: [R] string syntactic sugar in R? - long post

2005-05-07 Thread Prof Brian Ripley
On Sat, 7 May 2005, James Bullard wrote: The other thing to use is 'sprintf', which would be fantastic in R if it imputed types based on the format string. But it does in 2.1.0, the current version. As it is now, for your query you would do: sprintf(SELECT %s FROM table WHERE date = '%s', column,

Re: [R] string syntactic sugar in R? - long post

2005-05-07 Thread Gabor Grothendieck
On 5/7/05, charles loboz [EMAIL PROTECTED] wrote: Currently in R, constructing a string containing values of variables is done using 'paste' and can be an error-prone and traumatic experience. For example, when constructing a db query we have to write, paste(SELECT value FROM table