[R] Returning to parent function

Spencer Graves spencer.graves at prodsyse.com
Tue Mar 17 18:39:06 CET 2015



On 3/17/2015 10:01 AM, David Winsemius wrote:
> On Mar 16, 2015, at 5:05 PM, Saptarshi Guha wrote:
>
>> Example was complicated, but here is a simpler form
>>
>> continueIfTrue <- function(mm=return()){
>>     eval(mm)
>> }
> What are you trying to accomplish by passing `return()` to a formal parameter?


       Might returning a logical serve your purpose?  Then you could say 
"if(!continueIfTrue(...))return(...)".  Will this do what you want?


       Spencer
>
>> telemStats <- function(){
>>     y <- substitute(return())
> That last bit of code doesn't make a lot of sense either. The `substitute` function is specifically designed to NOT evaluate the first argument but rather to return an unevaluated call. If you wanted to actually "return" from that function you would assuredly not use `return` within the substitute argument.
>
> You need to explain what you want to accomplish  rather than posting failed code.
>



More information about the R-help mailing list