File: demos.R

package info (click to toggle)
r-base 3.1.1-1%2Bdeb8u1
  • links: PTS
  • area: main
  • in suites: jessie
  • size: 85,436 kB
  • ctags: 35,389
  • sloc: ansic: 306,779; fortran: 91,908; sh: 11,216; makefile: 5,311; yacc: 4,994; tcl: 4,562; objc: 746; perl: 655; asm: 553; java: 31; sed: 6
file content (30 lines) | stat: -rw-r--r-- 1,032 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#### Run all demos that do not depend on tcl and other specials.
.ptime <- proc.time()
set.seed(123)
options(keep.source=TRUE, useFancyQuotes=FALSE, warn = 1)

## Drop these for strict testing {and add them to demos2.R)
## lm.glm is in ../src/library/utils/man/demo.Rd }:
dont <- list(graphics = c("Hershey", "Japanese", "plotmath"),
             stats = c("lm.glm", "nlm")
             )
## don't take tcltk here
for(pkg in c("base", "graphics", "stats")) {

    demos <- list.files(file.path(system.file(package = pkg), "demo"),
                        pattern = "\\.R$")
    demos <- demos[is.na(match(demos, paste(dont[[pkg]], "R",sep=".")))]

    if(length(demos)) {
        if(need <- pkg != "base" &&
           !any((fpkg <- paste("package", pkg, sep=":")) == search()))
            library(pkg, character.only = TRUE)

        for(nam in sub("\\.R$", "", demos))
            demo(nam, character.only = TRUE)

        if(need) detach(pos = which(fpkg == search()))
    }
}

cat("Time elapsed: ", proc.time() - .ptime, "\n")