The R Project SVN R

Rev

Rev 5280 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5280 Rev 5281
Line 21... Line 21...
21
#Dbg> echo "R_HOME=$R_HOME"; echo
21
#Dbg> echo "R_HOME=$R_HOME"; echo
22
#Dbg> echo "FILES=$FILES"; echo ; echo; exit
22
#Dbg> echo "FILES=$FILES"; echo ; echo; exit
23
 
23
 
24
## 1) ---- Header ----
24
## 1) ---- Header ----
25
(cat <<_EOF_
25
(cat <<_EOF_
26
.ptime <- proc.time()
26
..CheckEnv <- new.env()
-
 
27
assign("ptime",proc.time(), env=..CheckEnv)
27
postscript('PKG-Examples.ps')
28
postscript('PKG-Examples.ps')
28
.par.postscript <- par(no.readonly = TRUE)
29
assign("par.postscript", par(no.readonly = TRUE), env=..CheckEnv)
29
options(contrasts = c(unordered = "contr.treatment", ordered =  "contr.poly"))
30
options(contrasts = c(unordered = "contr.treatment", ordered =  "contr.poly"))
30
_EOF_
31
_EOF_
31
) | sed "s/PKG/${PKG}/"
32
) | sed "s/PKG/${PKG}/"
32
if [ "$PKG" != "base" ]; then echo "library('$PKG')" ; fi
33
if [ "$PKG" != "base" ]; then echo "library('$PKG')" ; fi
33
 
34
 
Line 35... Line 36...
35
for file in $FILES
36
for file in $FILES
36
do
37
do
37
 bf=`basename $file .R`
38
 bf=`basename $file .R`
38
 if [ -n "`grep '_ Examples _' $file`" ]
39
 if [ -n "`grep '_ Examples _' $file`" ]
39
 then
40
 then
40
    echo 'rm(list = ls()); .Random.seed <- c(0,rep(7654,3))'
41
    echo 'll <- ls(all=TRUE);rm(list= ll[ll != "..CheckEnv"]); .Random.seed <- c(0,rep(7654,3))'
41
 else
42
 else
42
    if [ "$USER" = maechler ];then
43
    if [ "$USER" = maechler ];then
43
	## Remind certain people to upgrade the online help
44
	## Remind certain people to upgrade the online help
44
	echo "'$bf' has no Examples.." >& 2
45
	echo "'$bf' has no Examples.." >& 2
45
    fi
46
    fi
Line 47... Line 48...
47
 
48
 
48
 cat $file
49
 cat $file
49
 
50
 
50
 if [ -n "`grep 'par(' $file`" ];then
51
 if [ -n "`grep 'par(' $file`" ];then
51
    ## if there were 'par(..)' calls, now reset them:
52
    ## if there were 'par(..)' calls, now reset them:
52
    echo 'par(.par.postscript)'
53
    echo 'par(get("par.postscript",env=..CheckEnv))'
53
 fi
54
 fi
54
 if [ -n "`grep 'options(contrasts' $file`" ];then
55
 if [ -n "`grep 'options(contrasts' $file`" ];then
55
    ## if contrasts were set, now reset them:
56
    ## if contrasts were set, now reset them:
56
    echo 'options(contrasts = c(unordered = "contr.treatment", ordered =  "contr.poly"))'
57
    echo 'options(contrasts = c(unordered = "contr.treatment", ordered =  "contr.poly"))'
57
 fi
58
 fi
58
done
59
done
59
## 3) ---- Footer ----
60
## 3) ---- Footer ----
60
cat <<_EOF_
61
cat <<_EOF_
61
cat("Time elapsed: ", proc.time() - .ptime,"\n")
62
cat("Time elapsed: ", proc.time() - get("ptime",env=..CheckEnv),"\n")
62
dev.off(); quit('no')
63
dev.off(); quit('no')
63
_EOF_
64
_EOF_