Thank you David, Jim and Gunter.
Actually I knew about the list thing. Everything got confused in my head :-(
I guess I am a bit tired...
2010/4/16 David Winsemius
>
> On Apr 16, 2010, at 12:02 PM, Gustave Lefou wrote:
>
> Dear R users,
>>
>> I have a function which takes as arguments big array
On Apr 16, 2010, at 12:02 PM, Gustave Lefou wrote:
Dear R users,
I have a function which takes as arguments big arrays, say : w, x ,
y and z.
My function changes these arrays and I want them as result/output.
I have tried to write return(w,x,y,z), and thus to replace the
previous w,
x,
Below
Bert Gunter
Genentech Nonclinical Statistics
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Gustave Lefou
Sent: Friday, April 16, 2010 9:03 AM
To: r-help@r-project.org
Subject: [R] return of a function
Dear R users,
I
You can return a single object from a function. If you want multiple
values, use a list:
f <- function(x,y,z){
return(list(x=x, y=y, z=z))
}
value <- f(x,y,z)
# now copy the values
x <- value$x
y <- value$y
z <- value$z
On Fri, Apr 16, 2010 at 12:02 PM, Gustave Lefou wrote:
> Dear R use
Dear R users,
I have a function which takes as arguments big arrays, say : w, x , y and z.
My function changes these arrays and I want them as result/output.
I have tried to write return(w,x,y,z), and thus to replace the previous w,
x, y and z. It does not seem to work.
What can I do ?
Thank y
5 matches
Mail list logo