[R] query on "random.seed" not found error in code

Duncan Murdoch murdoch at stats.uwo.ca
Thu Sep 27 15:28:58 CEST 2007


On 9/27/2007 8:53 AM, paulandpen wrote:
> Hi,
> 
> I am trying to use AlgDesign and am partially successful
> 
> Two lines of code are taken from the help file
> 1. Line 1 (below) works fine
>> dat<-gen.factorial(levels=3,nVars=3,varNames=c("A","B","C"))
> 
> 2. Line 2 (below) does not work fine
>> desD<-optFederov(~quad(A,B,C),dat,nTrials=14,eval=TRUE)
> 
> Here is the result I get
> 
> Error in optFederov(~quad(A, B, C), dat, nTrials = 14, eval = TRUE) :
>     object ".Random.seed" not found
> 
> What do i need to do, to introduce this object into the process?

.Random.seed is created when you first call a random number generator. 
So this code is assuming it's not the first random thing in a session.

You can work around this bug by something like

runif(1)

before executing the code; that will create your copy of .Random.seed 
and things will work.

The package shouldn't assume .Random.seed exists, e.g. replace the line

     seed <- .Random.seed

with

     if (!exists(.Random.seed)) runif(1)
     seed <- .Random.seed

I've cc'd Bob Wheeler to let him know about this.

Duncan Murdoch


> 
> Thanks in advance
> 
> Paul
> 
> 
> 
> ----- Original Message ----- 
> From: "marcg" <mdgi at gmx.ch>
> To: <r-help at stat.math.ethz.ch>
> Sent: Thursday, September 27, 2007 5:21 PM
> Subject: [R] different colors for two wireframes in same plot
> 
> 
>> Hello R,
>>
>> According to:
>>
>> g <- expand.grid(x = 1:10, y = 5:15, gr = 1:2)
>> g$z <- log((g$x^g$g + g$y^2) * g$gr)
>> wireframe(z ~ x * y, data = g, groups = gr,
>>          scales = list(arrows = FALSE),
>>          drape = TRUE, colorkey = TRUE,
>>          screen = list(z = 30, x = -60))
>>
>> i have two wireframes in one plot.
>>
>> How could i change the color of the top - one to transparent (or only the 
>> grid). I want to give insight to the lower layer.
>>
>> Could one make an if-statment like (if gr==1 do drape=F or color=none) if 
>> gr=2 do drape=T, colorkey=T)
>>
>> Thanks for your help
>>
>> Marc
>>
>> -- 
>> Psssst! Schon vom neuen GMX MultiMessenger gehört?
>> Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list