From ligges at statistik.tu-dortmund.de  Tue Mar 24 14:45:57 2009
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Tue, 24 Mar 2009 14:45:57 +0100
Subject: [Rd] Error in FrF2 example on Mac OS
In-Reply-To: <22675998.post@talk.nabble.com>
References: <22675998.post@talk.nabble.com>
Message-ID: <49C8E415.3060702@statistik.tu-dortmund.de>



Ulrike Gr?mping wrote:
> Dear all,
> 
> I just noticed that the 0.9 update for FrF2 did not work out for Mac OS due
> to an error in an example that ran without error on all other platforms. I
> do not find any reason for this. In the past, umlauts or tab characters have
> sometimes been an issue, but I didn't find any of these. The function
> definition is 
> 
> FrF2(nruns = NULL, nfactors = NULL, factor.names = if (!is.null(nfactors)) {
> if (nfactors <= 50) Letters[1:nfactors] else
> paste("F", 1:nfactors, sep = "")} else NULL,
> default.levels = c(-1, 1), generators = NULL, resolution = NULL,
> estimable = NULL, max.nfree2fis = FALSE,
> randomize = TRUE, seed = NULL, ...){...}
> 
> and the simplest call to this function fails: 
> FrF2(8,4)
> gives the custom error message "nruns must be a power of 2.", which is
> generated in the first check within function FrF2: 
> 
>     if (!is.null(nruns)){
>        k <- floor(log2(nruns))
>        if (!2^k==nruns) stop("nruns must be a power of 2.")}


Probably a rounding issue on different platforms?
I guess the test should be something like:

if (!is.null(nruns)){
   if(!isTRUE(all.equal(log2(nruns) %% 1, 0)))
     stop("nruns must be a power of 2.")
}


Uwe




> Would the Mac (different from all other systems) require FrF2(nruns=8,
> nfactors=4) ? Or what else could be the issue here ?
> 
> Thanks for any pointers!
> 
> Regards, Ulrike



[Rd] Error in FrF2 example on Mac OS
Uwe Ligges