From: McGehee, Robert <Robert.McGehee_at_geodecapital.com>

Date: Thu 31 Mar 2005 - 00:14:29 EST

Date: Thu 31 Mar 2005 - 00:14:29 EST

I doubt it's possible to use Recall inside a sapply like this. sapply
(and lapply) make a copy of the function (FUN <- match.fun(FUN)) before
passing it inside an internal function (rval <- .Internal(lapply(X,
FUN)). So, while I'm not precisely sure how Recall is coded up, I bet
that once it is copied inside of sapply (and lapply), it loses the
context from which it was called.

I can think of a couple ways around this. First, you could construct a for loop instead of a sapply and use Recall. Second, you could replace Recall by just asking R what the name of the calling function is and pass that in to sapply. Something like this should work:

sapply(n, match.fun(sys.call()[[1]]))

**HTH,
**

Robert

-----Original Message-----

From: Robin Hankin [mailto:r.hankin@soc.soton.ac.uk]
Sent: Wednesday, March 30, 2005 3:28 AM

To: R-help@stat.math.ethz.ch

Subject: [R] Recall() and sapply()

Hi.

if(length(n)>1){return(sapply(n,f1))}
matrix(n,n,n)

*}
*

if(length(n)>1){return(sapply(n,Recall))}
matrix(n,n,n)

*}
*

How do I modify either function to use Recall()? What exactly is Recall() calling here?

-- Robin Hankin Uncertainty Analyst Southampton Oceanography Centre European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlReceived on Thu Mar 31 00:24:39 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:30:57 EST
*