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("HTMLapplets-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('HTMLapplets') Loading required package: R2HTML > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "HTMLapplets.data.frame" > > ### * HTMLapplets.data.frame > > flush(stderr()); flush(stdout()) > > ### Name: HTMLapplets.data.frame > ### Title: HTMLapplets.data.frame > ### Aliases: HTMLapplets.data.frame HTMLapplets > > > ### ** Examples > > data(ChickWeight) > > l <- split(ChickWeight[,c("Time","weight")], ChickWeight$Chick) > for(i in 1:length(l)) names(l[[i]]) <- c("Time",paste("Chick",i,sep="")) > chicks <- data.frame(Time=sort(unique(ChickWeight$Time))) > for(i in 1:length(l)) + chicks <- merge(chicks,l[[i]], all=TRUE) > mean <- apply(chicks,1,mean, na.rm=TRUE) > sd <- apply(chicks,1,sd, na.rm=TRUE) > > cat("CREATING \"./chicksGrid.html\"\n") CREATING "./chicksGrid.html" > > HTMLInitFile("./","chicksGrid") [1] ".//chicksGrid.html" > HTML.title("HTMLapplets") > # grid > HTMLapplets.data.frame(chicks[,1:10],height=100) > HTMLEndFile() > > > > cleanEx(); ..nameEx <- "HTMLapplets.plot" > > ### * HTMLapplets.plot > > flush(stderr()); flush(stdout()) > > ### Name: HTMLapplets.plot > ### Title: HTMLapplets.plot > ### Aliases: HTMLapplets.plot > > > ### ** Examples > > data(ChickWeight) > > l <- split(ChickWeight[,c("Time","weight")], ChickWeight$Chick) > for(i in 1:length(l)) names(l[[i]]) <- c("Time",paste("Chick",i,sep="")) > chicks <- data.frame(Time=sort(unique(ChickWeight$Time))) > for(i in 1:length(l)) + chicks <- merge(chicks,l[[i]], all=TRUE) > mean <- apply(chicks,1,mean, na.rm=TRUE) > sd <- apply(chicks,1,sd, na.rm=TRUE) > > cat("CREATING \"./chicksPlot.html\"\n") CREATING "./chicksPlot.html" > > # first plot > HTMLInitFile("./","chicksPlot1") [1] ".//chicksPlot1.html" > HTML.title("HTMLapplets") > HTMLapplets.plot(id="all", + x=chicks$Time, + y=chicks[,2:10], + xlab="time", ylab="Weight", main="Test1", + xlim=c(8,13), ylim=c(50,100), + type="l", pch=1, height=250, help=TRUE) > HTMLEndFile() > # second plot > HTMLInitFile("./","chicksPlot2") [1] ".//chicksPlot2.html" > HTML.title("HTMLapplets") > HTMLapplets.plot(id="summary", + x=chicks$Time, + y=mean, + xlab="time", ylab="Weight", type="l", main="Test2", + pch=1, height=250, background="e0e0e0", + data.link=FALSE, + diameter=round(mean/max(mean)*20+1), + col=gsub("#","",rgb(1-mean/max(mean),0,mean/max(mean))), + low.error=mean-sd, high.error=mean+sd) > HTMLEndFile() > > > > ### *