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
.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
>
>
>
>
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
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
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
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
6 matches
Mail list logo