[R] Returning to parent function
Jeff Newmiller
jdnewmil at dcn.davis.CA.us
Wed Mar 18 01:38:07 CET 2015
Perhaps read ?try
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
On March 16, 2015 3:08:35 PM PDT, Saptarshi Guha <saptarshi.guha at gmail.com> wrote:
>Hello,
>
>I would like a function X to return to the place that called the
>function XParent that called this function X.
>
>Y calls XParent
>Y = function(){
> XParent()
> print("hello")
>}
>
>XParent calls X
>
>XParent = function(){
> X()
> print("H")
>}
>
>X returns to the point just after the call to XParent. Hence
>print("H") is not called, but instead "hello" is printed.
>
>An example of what i'm going for is this
>
>continueIfTrue <- function(filterExp, grpname, subname,n=1){
> y <- substitute(filterExp)
> res <- isn(eval(y, envir=parent.frame()),FALSE)
> ## if res is FALSE, I would like to return from telemStats
>}
>
>telemStats <- function(a,b){
> b <- c(10,12)
> continueIfTrue( { length(b) >=10 }, "progStats","00")
> print("Since the above condition failed, I would not like this
>message to be printed")
>}
>
>I looked into callCC and signals but dont think i understood correctly.
>Any hints would be appreciated
>
>Kind Regards
>Saptarshi
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.
More information about the R-help
mailing list