Re: [R] Double return statement

2013-08-14 Thread ONKELINX, Thierry
Dear Katherine,

Combine both outputs in a list and return that.

return(list(first = output.1, second = output.2))

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and 
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
thierry.onkel...@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than 
asking him to perform a post-mortem examination: he may be able to say what the 
experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure 
that a reasonable answer can be extracted from a given body of data.
~ John Tukey


-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens 
Katherine Gobin
Verzonden: woensdag 14 augustus 2013 16:23
Aan: r-help@r-project.org
Onderwerp: [R] Double return statement

Dear R forum,

I have a function which generates say two outputs, say output_1 and output_2. 
Output_1 is a single row output whereas Output_2 is a dataframe having multiple 
records. Is it possible to use two return statements in function. Output_2 uses 
some records from output_1, hence I need to have these outputs generated from 
the same function.

Thanking in advance

With warm regards

Katherine
[[alternative HTML version deleted]]

* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en 
binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is 
door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the 
writer and may not be regarded as stating an official position of INBO, as long 
as the message is not confirmed by a duly signed document.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Double return statement

2013-08-14 Thread Sarah Goslee
Hi,

The usual thing to do is return a list containing output_1 and output_2.

Sarah

On Wed, Aug 14, 2013 at 10:23 AM, Katherine Gobin
 wrote:
> Dear R forum,
>
> I have a function which generates say two outputs, say output_1 and output_2. 
> Output_1 is a single row output whereas Output_2 is a dataframe having 
> multiple records. Is it possible to use two return statements in function. 
> Output_2 uses some records from output_1, hence I need to have these outputs 
> generated from the same function.
>
> Thanking in advance
>
> With warm regards
>
> Katherine



-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Double return statement

2013-08-14 Thread Katherine Gobin
Dear R forum,

I have a function which generates say two outputs, say output_1 and output_2. 
Output_1 is a single row output whereas Output_2 is a dataframe having multiple 
records. Is it possible to use two return statements in function. Output_2 uses 
some records from output_1, hence I need to have these outputs generated from 
the same function. 

Thanking in advance

With warm regards

Katherine
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.