R-alpha: misc.

Paul Gilbert (jellis@uottawa.ca)
Sun, 24 Nov 1996 22:33:38 -0400


Date: Sun, 24 Nov 1996 22:33:38 -0400
From: Paul Gilbert <jellis@uottawa.ca>
To: R testers <r-testers@stat.math.ethz.ch>
Subject: R-alpha: misc.

Hopefully I have now succeeded in making my email tool distinguish
between myself (Paul Gilbert) and my wife (Jackie Ellis). 

Obvoiusly the ultimate format for helpfiles has not yet been resolved.
As a "rat's periscope" to view the maze, I find grep "whatever you're
looking for" *.html actually works better than grepping a large file,
but not everyone has grep. I think there are some tools around for doing
full text searching on multiple HTML files, but I'm not sure where.

Following are some problems/S-differences which I've discovered. 1/ and
5/ are causing me the most trouble.

1/ is.vector(matrix(1:4,2,2)) returns TRUE in R 0.13 but I believe it
returns F in S. (Someone please verify this as I do not have access to
S.)

2/ vector("numeric",3) returns "cannot make vector of specified type".

3/ %o% does not work and has to be specied as outer().

4/ dim(NULL)[1]-1 gives NA in S and an error in R.

5/ I would like to be able to repeat a random experiment by optionally
passing the starting seed to a function. In S I then set the seed using
assign(.., where=1). I think I should be able to do this in R more or
less as follows, but I cannot get it to work. The problem may be in my
understanding of the envir argument, but experimenting (and even reading
the documentation) has not been successful.

foo <- function(n, seed=NULL)
  {if(!is.null(seed)) assign(".Random.seed", seed, envir=NULL)
   rnorm(n)
  }

.Random.seed
[1] 7081 9047 2098

> foo(3)
[1]  0.2364413  0.5793579 -0.7778567

> foo(3, seed=c(7081, 9047, 2098) )
[1] 0.3368038 0.8743070 0.8108451
> 


Paul Gilbert

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-