Re: [R] function that uses a variable name as the parameter

2008-11-13 Thread William Dunlap
On 12/11/2008 7:59 AM, David Croll wrote: > > Hello dear R people! > > > Several times it occurred to me that a function that uses a variable name as a parameter would be helpful, but I did not find out how to write such a function. I have experience in several programming language, but I did no

Re: [R] function that uses a variable name as the parameter

2008-11-12 Thread Greg Snow
.8111 > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > project.org] On Behalf Of David Croll > Sent: Wednesday, November 12, 2008 5:59 AM > To: r-help@r-project.org > Subject: [R] function that uses a variable name as the parameter > > > >

Re: [R] function that uses a variable name as the parameter

2008-11-12 Thread Duncan Murdoch
On 12/11/2008 7:59 AM, David Croll wrote: Hello dear R people! Several times it occurred to me that a function that uses a variable name as a parameter would be helpful, but I did not find out how to write such a function. I have experience in several programming language, but I did not come

Re: [R] function that uses a variable name as the parameter

2008-11-12 Thread Wacek Kusnierczyk
David Croll wrote: > Hello dear R people! > > > Several times it occurred to me that a function that uses a variable name as > a parameter would be helpful, but I did not find out how to write such a > function. I have experience in several programming language, but I did not > come across a hel

Re: [R] function that uses a variable name as the parameter

2008-11-12 Thread bartjoosen
You're almost there: a <- 12 # starting value add <- function(variable,increment) { variable + increment } add(a,25) you shouldn't assign variable + increment to variable, unless you put a return in your function: add <- function(variable,increment) { variable <- variable + incremen

[R] function that uses a variable name as the parameter

2008-11-12 Thread David Croll
Hello dear R people! Several times it occurred to me that a function that uses a variable name as a parameter would be helpful, but I did not find out how to write such a function. I have experience in several programming language, but I did not come across a helpful trick... What I want to