From thomas@biostat.washington.edu  Sat Sep 13 20:04:51 1997
From: thomas@biostat.washington.edu (Thomas Lumley)
Date: Sat, 13 Sep 1997 12:04:51 -0700 (PDT)
Subject: R-alpha: compatibility
In-Reply-To: <199709131524.RAA03703@sophie.ethz.ch>
Message-ID: <Pine.SUN.3.95.970913115858.557A-100000@troi>


Two compatibility issues found while trying to convert a simulation from S
to R.

1. set.seed()  We don't have this function.  According to Venables &
Ripley it just picks a seed from a list of 1000 possibilities. How about
"set.seed" <-function (i) 
{
        if (any(i > 1000) | any(i < 1)) 
                stop("argument to set.seed() must be in 1:1000")
        if (any(i != trunc(i))) 
                stop("argument to set.seed()must be an integer")
        .Random.seed <<- as.integer((200 * c(i, i^2, i^3))%%c(30269, 
                30307, 30323))
}


2. lapply() in S-PLUS works on vectors, ie
lapply(X, FUN) works like lapply(as.list(X),FUN) orsapply(X,FUN,simplify=F)


	-thomas



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: compatibility
Thomas Lumley