[R] return of a function

Bert Gunter gunter.berton at gene.com
Fri Apr 16 18:12:21 CEST 2010


Bert Gunter
Genentech Nonclinical Statistics

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Gustave Lefou
Sent: Friday, April 16, 2010 9:03 AM
To: r-help at r-project.org
Subject: [R] return of a function

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 ?

-- 1. Read the Help file? -- which says:



value: An expression. 

-- and note that w,x,y,z is **not** a legal R expression

2. Have you read the online documentation, including an Introduction to R?
There you would find many examples.

3. return(list(w,x,y,z))   ## is what you want 
## or even 
list(w,x,y,z) ## without the return(), as the last R expression is by
default what is returned.

Thank you very much,

	[[alternative HTML version deleted]]

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list