R-alpha: compatibility
Thomas Lumley
thomas@biostat.washington.edu
Sat, 13 Sep 1997 12:04:51 -0700 (PDT)
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-