Re: [R] Passing the name of a variable to a function

2010-08-04 Thread Douglas Bates
On Wed, Aug 4, 2010 at 2:09 PM, Erik Iverson wrote: > Hello, > > >> I have a problem which has bitten me occasionally. I often need to >> prepare graphs for many variables in a data set, but seldom for all. >> or for any large number of sequential or sequentially named variables. >> Often I need s

Re: [R] Passing the name of a variable to a function

2010-08-04 Thread Anthony Staines
Thanks to Joshua and Erik for very helpful suggestions. This clarifies what I had found to be a tricky area of the documentation! Best wishes, Anthony Staines -- Anthony Staines,  Professor of Health Systems Research, School  of Nursing, Dublin City University, Dublin 9, Ireland. Tel:- +353 1 700

Re: [R] Passing the name of a variable to a function

2010-08-04 Thread Liviu Andronic
Dear Anthony On Wed, 4 Aug 2010 14:56:58 +0100 Anthony Staines wrote: > What I would like to do is something like "write a function which > takes the *name* of a variable, presumably a s a character string, > from a dataframe, as one argument, and the dataframe, as a second > argument". > I am

Re: [R] Passing the name of a variable to a function

2010-08-04 Thread Joshua Wiley
Hi Anthony, I don't know if this will help you. A similar method should work for any function that accepts a formula, which is your main issue I think. Outside of formulae, you should just be able to pass the arguments directly (as with the data argument of xyplot). The only other thought that

Re: [R] Passing the name of a variable to a function

2010-08-04 Thread Erik Iverson
Hello, I have a problem which has bitten me occasionally. I often need to prepare graphs for many variables in a data set, but seldom for all. or for any large number of sequential or sequentially named variables. Often I need several graphs for different subsets of the dataset for a given vari

[R] Passing the name of a variable to a function

2010-08-04 Thread Anthony Staines
Dear colleagues, I have a problem which has bitten me occasionally. I often need to prepare graphs for many variables in a data set, but seldom for all. or for any large number of sequential or sequentially named variables. Often I need several graphs for different subsets of the dataset for a giv