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("CGIwithR-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('CGIwithR') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "CGIwithR-internal" > > ### * CGIwithR-internal > > flush(stderr()); flush(stdout()) > > ### Name: CGIwithR-internal > ### Title: Functions and Data Used Internally by the CGIwithR Package > ### Aliases: CGIparse ascii hexDecode > ### Keywords: internal > > ### ** Examples > > > > cleanEx(); ..nameEx <- "HTMLtools" > > ### * HTMLtools > > flush(stderr()); flush(stdout()) > > ### Name: HTMLtools > ### Title: Utility Functions for Writing in HTML > ### Aliases: CGIwithR HTMLheader tag untag comments br linkto mailto img lf > ### Keywords: interface > > ### ** Examples > > > useUnquotedTagnames <- TRUE > > testpage<-function(){ + tag(HTML) + tag(HEAD) + tag(TITLE) + cat("An example HTML page") + untag(TITLE) + untag(HEAD) + lf() + comments("Some comments to be ignored by the web browser") + lf(2) + tag(BODY, bgcolor = "yellow") + lf(2) + tag(h1) + cat("A large heading") + untag(h1) + lf(2) + tag(p) + cat("A table of results:") + tag(pre) + lf() + indentPrint(data.frame(Est = c(1.23,3.45), + StErr = c(0.86,0.78), + row.names = c("b0","b1"))) + lf() + untag(pre) + untag(p) + lf(2) + cat("Here is a graph:") ; br() + img(src="http://www.stats.ox.ac.uk/~firth/CGIwithR/test.png") ; br(2) + lf(2) + cat("The author is ") + mailto("David Firth", "david.firth@nuffield.ox.ac.uk") + cat(" and here is his ") + linkto("website.", "http://www.stats.ox.ac.uk/~firth/") ; br() + lf() + tag(p) + cat("Output produced at ", date()) + untag(p) + lf() + untag(BODY) + lf() + untag(HTML) + lf() + } > > # sink("temp.html") > testpage() An example HTML page

A large heading

A table of results:

        Est StErr
    b0 1.23  0.86
    b1 3.45  0.78

Here is a graph:


The author is David Firth and here is his website.

Output produced at Wed Jul 13 09:20:54 2005

> > ## The output if pasted into a file should be viewable by > ## a web browser. Or if the this-is-escaped-codenormal-bracket73bracket-normal was done, > ## just view temp.html in the web browser. > > > > > cleanEx(); ..nameEx <- "indentPrint" > > ### * indentPrint > > flush(stderr()); flush(stdout()) > > ### Name: indentPrint > ### Title: Print an Object with Indentation > ### Aliases: indentPrint > ### Keywords: interface > > ### ** Examples > > indentPrint(1:4,indent=10) [1] 1 2 3 4 > > > > cleanEx(); ..nameEx <- "scanText" > > ### * scanText > > flush(stderr()); flush(stdout()) > > ### Name: scanText > ### Title: Scan a Character String > ### Aliases: scanText > ### Keywords: interface > > ### ** Examples > > scanText("A few short words") [1] "A" "few" "short" "words" > as.numeric(scanText("1 2 3\n89 90")) [1] 1 2 3 89 90 > scanText("A B C \n 4 5 6", what = list("A", "A", "A", 0, 0, 0)) [[1]] [1] "A" [[2]] [1] "B" [[3]] [1] "C" [[4]] [1] 4 [[5]] [1] 5 [[6]] [1] 6 > > > > cleanEx(); ..nameEx <- "webPNG" > > ### * webPNG > > flush(stderr()); flush(stdout()) > > ### Name: webPNG > ### Title: A Wrapper for the `bitmap' Graphics Device > ### Aliases: webPNG > ### Keywords: interface device > > ### ** Examples > > ## Not run: > ##D graphDir <- "/users/david/public_html/graphs/" > ##D webPNG("mygraph.png") > ##D ## then do whatever plotting is required... > ##D > ## End(Not run) > > > > ### *