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("IDPmisc-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('IDPmisc') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "Arrows" > > ### * Arrows > > flush(stderr()); flush(stdout()) > > ### Name: Arrows > ### Title: Pretty Open or Closed Arrows > ### Aliases: Arrows > ### Keywords: aplot > > ### ** Examples > > ## a bunch of different arrows > plot(c(0,10), c(0,10), type="n") > Arrows(5, 5, 5,10, size=3, + sh.lwd=5, sh.lty=2, + h.lwd=5) > Arrows(5, 5, 7.5, 9, size=3, open=TRUE, + sh.adj=0.7, sh.lwd=5, sh.lty=2, + h.col.bo="red",h.lwd=5) > Arrows(5, 5, 9, 7.5, size=3, open=FALSE, + sh.adj=1, sh.lwd=5, sh.col="blue", + h.col.bo="red",h.lwd=2) > Arrows(5, 5, 10, 5, size=2.5, width=1.5, open=FALSE, + sh.adj=1, sh.lwd=7, sh.col="blue") > Arrows(5, 5, 9, 2.5, size=4, open=FALSE, + sh.lty=0, + h.col.bo="black",h.lwd=5) > Arrows(5, 5, 7.5, 1) > Arrows(5, 5, 5, 0, size=2) > Arrows(5, 5, 2.5, 1, size=2, width=1) > > ## vector field > x<- runif( 20) > y<- runif( 20) > u<- 0.1+0.02*rnorm(20) > v<- 0.1+0.02*rnorm(20) > plot(x,y,xlim=range(c(x,x+u)),ylim=range(c(y,y+v)),type="n") > Arrows(x,y,x+u,y+v,sh.col="blue") > > > > cleanEx(); ..nameEx <- "IDPcolorRamp" > > ### * IDPcolorRamp > > flush(stderr()); flush(stdout()) > > ### Name: IDPcolorRamp > ### Title: Color Ramp for Ordered Values > ### Aliases: IDPcolorRamp > ### Keywords: color > > ### ** Examples > > IDPcolorRamp(10) [1] "#B0FFF1" "#A0FF73" "#BCFF66" "#DEFF59" "#FFF84D" "#FFBC44" "#FF7A3B" [8] "#FF3333" "#B31272" "#520066" > > > > cleanEx(); ..nameEx <- "Image" > > ### * Image > > flush(stderr()); flush(stdout()) > > ### Name: Image > ### Title: Displays the Density of Points in a Scatter Plot by Colors > ### Aliases: Image > ### Keywords: aplot > > ### ** Examples > > x <- rnorm(10000) > y <- rnorm(10000,10) > plot(x+y,y,type="n") > Image(x+y,y) > abline(a=0,b=1) > > ## > plot.default(iris$Species,iris$Petal.Width, + xlim=c(0.5,3.5), + type="n",axes=FALSE) > axis(1,at=1:3,lab=levels(iris$Species)) > axis(2) > Image(iris$Species,iris$Petal.Width,pixs=3) > > ## The above can be merged to > ixyplot(iris$Species,iris$Petal.Width,pixs=3, minL.lab=10) > > > > > cleanEx(); ..nameEx <- "NaRV.omit" > > ### * NaRV.omit > > flush(stderr()); flush(stdout()) > > ### Name: NaRV.omit > ### Title: Omits Observations with NA, NaN, Inf and -Inf Values > ### Aliases: NaRV.omit inf.omit > ### Keywords: manip > > ### ** Examples > > M <- matrix(c(NA,1:7,NA),nrow=3) > M [,1] [,2] [,3] [1,] NA 3 6 [2,] 1 4 7 [3,] 2 5 NA > NaRV.omit(M) [,1] [,2] [,3] [1,] 1 4 7 attr(,"na.action") [1] 1 3 attr(,"class") [1] "omit" > > DF <- iris[sample(1:nrow(iris),12),] > DF[1,1] <- NA > DF[10,5] <- NA > row.names(DF) <- 1:12 > DF Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 NA 3.4 1.5 0.2 setosa 2 5.7 2.8 4.5 1.3 versicolor 3 5.4 3.0 4.5 1.5 versicolor 4 6.3 2.8 5.1 1.5 virginica 5 4.7 3.2 1.6 0.2 setosa 6 7.4 2.8 6.1 1.9 virginica 7 6.3 3.4 5.6 2.4 virginica 8 5.6 2.7 4.2 1.3 versicolor 9 5.5 2.5 4.0 1.3 versicolor 10 4.4 2.9 1.4 0.2 11 5.2 3.4 1.4 0.2 setosa 12 4.8 3.4 1.9 0.2 setosa > NaRV.omit(DF) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 2 5.7 2.8 4.5 1.3 versicolor 3 5.4 3.0 4.5 1.5 versicolor 4 6.3 2.8 5.1 1.5 virginica 5 4.7 3.2 1.6 0.2 setosa 6 7.4 2.8 6.1 1.9 virginica 7 6.3 3.4 5.6 2.4 virginica 8 5.6 2.7 4.2 1.3 versicolor 9 5.5 2.5 4.0 1.3 versicolor 11 5.2 3.4 1.4 0.2 setosa 12 4.8 3.4 1.9 0.2 setosa > > NaRV.omit(c(NA,1:10,NA)) [1] 1 2 3 4 5 6 7 8 9 10 > > fac <- factor(c(NA,sample(c(1:9)))) > NaRV.omit(fac) [1] 7 4 6 3 8 5 2 9 1 Levels: 1 2 3 4 5 6 7 8 9 > > fac <- factor(c(NA,sample(c(1:9))),exclude=NULL) > fac [1] 2 6 1 9 8 7 5 3 4 Levels: 1 2 3 4 5 6 7 8 9 > NaRV.omit(fac) [1] 2 6 1 9 8 7 5 3 4 Levels: 1 2 3 4 5 6 7 8 9 > > > > cleanEx(); ..nameEx <- "col2hsv" > > ### * col2hsv > > flush(stderr()); flush(stdout()) > > ### Name: col2hsv > ### Title: Converting Color to hsv Code > ### Aliases: col2hsv > ### Keywords: color dplot > > ### ** Examples > > col2hsv(c("blue","green","red")) [,1] [,2] [,3] h 0.6666667 0.3333333 0 s 1.0000000 1.0000000 1 v 1.0000000 1.0000000 1 > > > > cleanEx(); ..nameEx <- "data.sheet" > > ### * data.sheet > > flush(stderr()); flush(stdout()) > > ### Name: data.sheet > ### Title: Coercing a list to a data.frame > ### Aliases: data.sheet > ### Keywords: manip > > ### ** Examples > > data.sheet(list(a=1:5,b=1:4)) a b [1,] 1 1 [2,] 2 2 [3,] 3 3 [4,] 4 4 [5,] 5 NA > > > > cleanEx(); ..nameEx <- "ilagplot" > > ### * ilagplot > > flush(stderr()); flush(stdout()) > > ### Name: ilagplot > ### Title: Image Lag Plot Matrix for Large Time Series > ### Aliases: ilagplot > ### Keywords: hplot > > ### ** Examples > > zmax <- ilagplot(sunspot.month, pixs=2, set.lags=1:9, + mfrow=c(3,3),border=FALSE,main="Test") Warning: Separate color coding for each image > ilagplot(sunspot.month, pixs=2, zmax=zmax, set.lags=1:6, + mfrow=c(2,3), border=FALSE) > > x <- rnorm(100000) > ilagplot(x+c(x[-1],0)+c(x[-(1:2)],0,0)+c(x[-(1:3)],0,0,0), + set.lags=1:4) Warning: Separate color coding for each image > > > > cleanEx(); ..nameEx <- "ipairs" > > ### * ipairs > > flush(stderr()); flush(stdout()) > > ### Name: ipairs > ### Title: Image Scatter Plot Matrix for Large Datasets > ### Aliases: ipairs > ### Keywords: hplot > > ### ** Examples > > zmax <- ipairs(airquality,pixs=2,main="Air Quality") Warning: Separate color coding for each image > ipairs(airquality,pixs=2,zmax=zmax,border=TRUE) > > zmax <- ipairs(iris,pixs=2) Warning: Separate color coding for each image > ipairs(iris,pixs=2,zmax=zmax) > > > > cleanEx(); ..nameEx <- "ixyplot" > > ### * ixyplot > > flush(stderr()); flush(stdout()) > > ### Name: ixyplot > ### Title: Image Scatter Plot for Large Datasets > ### Aliases: ixyplot > ### Keywords: hplot > > ### ** Examples > > x <- rnorm(100000) > y <- atan(rnorm(100000,0)) > ixyplot(x,y) > ixyplot(x,pixs=2) > ixyplot(iris[,1:2],pixs=4) > ixyplot(iris[,"Petal.Width"],iris[,"Species"],pixs=4) > ixyplot(x=iris[,"Species"],y=iris[,"Petal.Width"],pixs=4,border=TRUE, + xlab="Species", + ylab="Petal Width", + main="Iris Species and Petal Width") > > > > cleanEx(); ..nameEx <- "ok" > > ### * ok > > flush(stderr()); flush(stdout()) > > ### Name: ok > ### Title: Sets NAs in Logical Objects to FALSE > ### Aliases: ok > ### Keywords: manip > > ### ** Examples > > ok(c(FALSE,TRUE,NA,TRUE)) [1] FALSE TRUE FALSE TRUE > > > > cleanEx(); ..nameEx <- "poster.plot" > > ### * poster.plot > > flush(stderr()); flush(stdout()) > > ### Name: poster.plot > ### Title: Convenient xyplot with Differently Colored Margin and Plot > ### Region > ### Aliases: poster.plot > ### Keywords: hplot > > ### ** Examples > > poster.plot(iris[,1],iris[,2], col=c("red","black"), + xlab="Sepal.Length", ylab="Sepal.Width") > > poster.plot(iris[,1],col="red",ylab="Sepal.Length") > > poster.plot(iris[,c(1,3)],col.fg="violet", + xlab="Sepal.Length",ylab="Petal.Length") > > > > cleanEx(); ..nameEx <- "showColors" > > ### * showColors > > flush(stderr()); flush(stdout()) > > ### Name: showColors > ### Title: Displays vectors of colors > ### Aliases: showColors > ### Keywords: color hplot > > ### ** Examples > > showColors(IDPcolorRamp(5)) > showColors(IDPcolorRamp(200),border=FALSE) > showColors(IDPcolorRamp(200),border=FALSE,ntm=5) > > showColors(IDPcolorRamp(4, + colInt = data.frame( + h = c(0.47, 0.28, 0.22, 0.2, 0.00), + s = c(0.3, 0.55, 0.75, 0.75, 0.75), + v = c(1, 1, 1, 1, 1)), + fr = c(0.2,0.2,0.2)) + ,border=FALSE) > > showColors(IDPcolorRamp(200, + t(col2hsv(c("darkviolet","blue", + "green","yellow","red"))), + fr=rep(0.25,3)),border=FALSE) > > > > > cleanEx(); ..nameEx <- "zoom" > > ### * zoom > > flush(stderr()); flush(stdout()) > > ### Name: zoom > ### Title: Zooming in and out in a 2d-Plot > ### Aliases: zoom > ### Keywords: iplot dynamic > > ### ** Examples > > i <- 1:100 > y <- i*sin(i*(pi/16)) > y <- c(rev(y),y) > > ## comment next line out to run the example > ## zoom(fun=plot, zoom.col="red", x=1:200, y=y, ty="l", xlab="index") > > > > ### *