R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("conf.design-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('conf.design') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "conf.design" > > ### * conf.design > > flush(stderr()); flush(stdout()) > > ### Name: conf.design > ### Title: Construct symmetric confounded factorial designs. > ### Aliases: conf.design > ### Keywords: design > > ### ** Examples > > # Generate a 3^4 factorial with A B^2 C and B C D confounded with blocks. > d34 <- conf.design(rbind(c(1,2,1,0), c(0,1,1,1)), p=3, treatment.names + = LETTERS[1:4]) > > > > cleanEx(); ..nameEx <- "conf.set" > > ### * conf.set > > flush(stderr()); flush(stdout()) > > ### Name: conf.set > ### Title: Find confounded effects. > ### Aliases: conf.set > ### Keywords: design > > ### ** Examples > > G <- rbind(c(1,2,1,0), c(0,1,1,1)) > dimnames(G) <- list(NULL, LETTERS[1:4]) > conf.set(G, 3) A B C D [1,] 1 2 1 0 [2,] 0 1 1 1 [3,] 1 0 2 1 [4,] 1 1 0 2 > # A B C D > # [1,] 1 2 1 0 > # [2,] 0 1 1 1 > # [3,] 1 0 2 1 > # [4,] 1 1 0 2 > # If A B^2 C and B C D are confounded with blocks, then so are A C^2 D > # and A B D^2. Only three-factor interactions are confounded, so the > # design is presumably useful. > > > > cleanEx(); ..nameEx <- "direct.sum" > > ### * direct.sum > > flush(stderr()); flush(stdout()) > > ### Name: direct.sum > ### Title: Form the direct sum of designs. > ### Aliases: direct.sum > ### Keywords: design > > ### ** Examples > > # Generate a half replicate of a 2^3 x 3^2 experiment. The factors are > # to be A, B, C, D, E. The fractional relation is to be I = ABC and the > # DE effect is to be confounded with blocks. > > # First construct the 2^3 design, confounded in two blocks: > d1 <- conf.design(c(1,1,1), p=2, treatment.names=LETTERS[1:3]) > > # Next the 3^2 design, with DE confounded in blocks: > d2 <- conf.design(c(1,1), p=3, treatment.names=LETTERS[4:5]) > > # Now extract the principal block from the 2^3 design and form the direct > # sum withthe 3^2 design > dsn <- direct.sum(d1[d1$Blocks=="0",], d2) > > > > > cleanEx(); ..nameEx <- "factorize" > > ### * factorize > > flush(stderr()); flush(stdout()) > > ### Name: factorize > ### Title: Generic function. > ### Aliases: factorize factorize.default factorize.factor > ### Keywords: design > > ### ** Examples > > factorize(18) [1] 2 3 3 > # [1] 2 3 3 > f <- factor(rep(0,5), rep(6,5)) > fd <- factorize(f) > > > > cleanEx(); ..nameEx <- "join" > > ### * join > > flush(stderr()); flush(stdout()) > > ### Name: join > ### Title: Amalgamate two or more factors. > ### Aliases: join > ### Keywords: design > > ### ** Examples > > d1 <- conf.design(c(1,1,1), 2, treatment.names=LETTERS[1:3]) > d2 <- conf.design(c(0,1,1), 2, treatment.names=LETTERS[1:3]) > fd1d2 <- join(d1,d2) > > > > cleanEx(); ..nameEx <- "primes" > > ### * primes > > flush(stderr()); flush(stdout()) > > ### Name: primes > ### Title: Prime numbers > ### Aliases: primes > ### Keywords: design > > ### ** Examples > > primes(50) [1] 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 > # [1] 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 > > > > cleanEx(); ..nameEx <- "rjoin" > > ### * rjoin > > flush(stderr()); flush(stdout()) > > ### Name: rjoin > ### Title: Concatenate designs by rows. > ### Aliases: rjoin > ### Keywords: design > > ### ** Examples > > # A two replicate partially confounded factorial design. > d1 <- conf.design(c(1,1,1), 2, treatment.names=LETTERS[1:3]) > d2 <- conf.design(c(0,1,1), 2, treatment.names=LETTERS[1:3]) > dsn <- rjoin(d1, d2) > > > > ### *