[R] Returning to parent function
Berend Hasselman
bhh at xs4all.nl
Tue Mar 17 07:27:12 CET 2015
> On 16-03-2015, at 23:08, 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.
>
I do not understand what you are saying or implying here.
Take this R code:
####<code>
Y <- function(){
XParent()
print("hello")
}
XParent <- function(){
X()
print("H")
}
X <- function() { print("In function X") }
Y()
####</code>
and this is the output:
[1] "In function X"
[1] "H"
[1] "hello"
Implying that everything you seem to want printed is acually printed.
Berend
More information about the R-help
mailing list