.GlobalEnv <- globalenv() attach(NULL, name = "Autoloads") .AutoloadEnv <- pos.to.env(2) assign(".Autoloaded", NULL, env=.AutoloadEnv) T <- TRUE F <- FALSE version <- structure(R.Version(), class = "simple.list") .Machine <- Machine() .Platform <- Platform() options(na.action = "na.omit") options(show.signif.stars = TRUE) options(show.coef.Pvalues = TRUE) ###-*- R -*- Macintosh Specific ---- .Library <- paste(R.home(), "library", sep=.Platform$file.sep) .lib.loc <- .Library options(papersize = "a4") options(device = "macintosh") options(pager= "macintosh") macintosh <- function (display = "", width = 5, height = 5, pointsize = 12) .Internal(Macintosh(display, width, height, pointsize)) options(unzip="mac.unzip") options(device="macintosh") options(graphics.record=FALSE) options(editor="macintosh") options(na.action = "na.omit") options(show.signif.stars = TRUE) options(show.coef.Pvalues = TRUE) options(keep.source = interactive()) # was `TRUE' in 1.0.x options(warn = 0) options(help.try.all.packages = FALSE) options(CRAN = "http://cran.r-project.org") #options(verbose=TRUE) help.start <- function(gui = "irrelevant", browser = "irrelevant") { a <- system.file("rmac.html", pkg="doc:html", lib=R.home()) print(a) if (a == "") a <- system.file("rmac.htm", pkg="doc:html", lib=R.home()) if (a == "") stop("I can't find the html help\n") else { a <- gsub("/", "\\\\", a) cat("If nothing happens, you have to open `",a,"' yourself\n") .Internal(help.start()); } invisible("") } zip.file.extract <- function(file, zipname="R.zip") { if(file.exists(file)) return(file) # if the files exists, does not # replace it ofile <- gsub("::::", ":", file) path <- sub("[^:]*$","", ofile) # changed "/" in ":" topic <- substr(ofile, nchar(path)+1, 1000) if(file.exists(file.path(path, zipname,fsep=""))) { tempdir <- sub("[^:]*$","", tempfile()) if((unzip <- getOption("unzip")) != "internal") { if((unzip <- getOption("unzip")) != "mac.unzip") { if(!system(paste(unzip, ' -oq "', file.path(path, zipname), '" ', topic, " -d ", tempdir, sep=""), invisible = TRUE)) file <- paste(tempdir, topic, sep="") } else { # mac.unzip rc <- .Internal(int.unzip(file.path(path, zipname,fsep=""), topic, path)) if (rc != 0) warning("Error in MacUnZip") } } else { rc <- .Internal(int.unzip(file.path(path, zipname), topic, tempdir)) if (rc == 10) warning(paste(R.home(), "unzip\\unzip32static.dll cannot be loaded", sep="\\")) if (rc == 0) file <- paste(tempdir, topic, sep="") } } file } demo <- function(topic, device = getOption("device")) { if (is.character(device)) device <- get(device) Topics <-cbind(graphics = c("graphics", "graphics.R", "G"), image = c("graphics", "image.R", "G"), lm.glm = c("models", "lm+glm.R", "G"), glm.vr = c("models", "glm-v+r.R", ""), nlm = c("nlm", "valley.R", ""), recursion = c("language", "recursion.R", "G"), scoping = c("language", "scoping.R", ""), is.things = c("language", "is-things.R", "") ) dimnames(Topics)[[1]] <- c("dir", "file", "flag") topic.names <- dimnames(Topics)[[2]] demo.help <- function() { cat("Use `demo(topic)' where choices for argument `topic' are:\n") cbind(topics = topic.names) } if(missing(topic)) return(demo.help()) topic <- substitute(topic) if (!is.character(topic)) topic <- deparse(topic)[1] i.top <- pmatch(topic, topic.names) if (is.na(i.top) || i.top == 0) { cat("unimplemented `topic' in demo.\n") print(demo.help()) stop() } else { topic <- topic.names[i.top] cat("\n\n\tdemo(",topic,")\n\t---- ",rep("~",nchar(topic)), "\n\nType to start : ",sep="") readline() if(dev.cur()<=1 && Topics["flag",i.top] == "G") device() source(file.path(R.home(), "demos", Topics["dir", i.top], Topics["file", i.top]), echo = TRUE, max.deparse.length=250) } } .First <- function() { require("ctest", quietly=TRUE) }