[R] Recall() and sapply()

From: Robin Hankin <r.hankin_at_soc.soton.ac.uk>
Date: Wed 30 Mar 2005 - 18:28:08 EST


I'm having difficulty following the advice given in help(Recall). Consider the two
following toy functions:

f1 <- function(n){

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

f2 <- function(n){

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

f1() works as desired (that is, f(1:3), say, gives me a three element list whose i-th element
is an i-by-i matrix whose elements are all i).

But f2() doesn't.

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
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Wed Mar 30 18:35:11 2005

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