The R Project SVN R

Rev

Rev 5138 | Rev 5429 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5138 Rev 5298
Line 2... Line 2...
2
exloc <- file.path("../../../../library", PKG, "R-ex")
2
exloc <- file.path("../../../../library", PKG, "R-ex")
3
if(!file.exists(exloc)) stop("no examples found")
3
if(!file.exists(exloc)) stop("no examples found")
4
list.of.files <- list.files(exloc, ".*\\.R")
4
list.of.files <- list.files(exloc, ".*\\.R")
5
file <- paste(PKG, "-ex.R", sep="")
5
file <- paste(PKG, "-ex.R", sep="")
6
file.create(file)
6
file.create(file)
7
cat(file=file, append=T, '.ptime <- proc.time()\n')
7
cat(file=file, append=T, '..CheckEnv <- new.env()\n',
-
 
8
'assign("ptime",proc.time(), env=..CheckEnv)\n')
8
cat(file=file, append=T,
9
cat(file=file, append=T,
9
    paste('postscript("', PKG, '-Examples.ps")\n', sep=""))
10
    paste('postscript("', PKG, '-Examples.ps")\n', sep=""))
-
 
11
cat(file=file, append=T,
10
cat(file=file, append=T, '.par.postscript <- par(no.readonly = TRUE)\n')
12
    'assign("par.postscript", par(no.readonly = TRUE), env=..CheckEnv)\n')
11
cat(file=file, append=T, 'options(contrasts = c(unordered = "contr.treatment", ordered =  "contr.poly"))\n')
13
cat(file=file, append=T, 'options(contrasts = c(unordered = "contr.treatment", ordered =  "contr.poly"))\n')
12
cat(file=file, append=T, 'options(pager="console")\n')
14
cat(file=file, append=T, 'options(pager="console")\n')
13
if(PKG != "base")
15
if(PKG != "base")
14
    cat(file=file, append=T, paste('library(', PKG, ')', "\n"), sep="")
16
    cat(file=file, append=T, paste('library(', PKG, ')', "\n"), sep="")
15
for(f in list.of.files) {
17
for(f in list.of.files) {
-
 
18
    cat(file=file, append=T,
16
    cat(file=file, append=T, '.Random.seed <- c(0,rep(7654,3)); rm(list = ls())\n')
19
        'll <- ls(all=TRUE);rm(list= ll[ll != "..CheckEnv"]); .Random.seed <- c(0,rep(7654,3))\n')
17
    file.append(file, file.path(exloc, f))
20
    file.append(file, file.path(exloc, f))
18
    cat(file=file, append=T, 'par(.par.postscript)\n')
21
    cat(file=file, append=T, 'par(get("par.postscript",env=..CheckEnv))\n')
19
    cat(file=file, append=T, 'options(contrasts = c(unordered="contr.treatment", ordered = "contr.poly"))\n')
22
    cat(file=file, append=T, 'options(contrasts = c(unordered="contr.treatment", ordered = "contr.poly"))\n')
20
}
23
}
-
 
24
cat(file=file, append=T,
21
cat(file=file, append=T, 'cat("Time elapsed: ", proc.time() - .ptime,"\\n")\n')
25
    'cat("Time elapsed: ", proc.time() - get("ptime",env=..CheckEnv),"\\n")\n')
22
cat(file=file, append=T, 'dev.off(); quit("no")\n')
26
cat(file=file, append=T, 'dev.off(); quit("no")\n')
23
 
27