[r-cran-plotrix] 27/29: New upstream version 3.6-4

Andreas Tille tille at debian.org
Fri Sep 29 06:53:33 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-plotrix.

commit 3069e3320fbfcaf5afa953efd4897b23c8fb53c2
Author: Andreas Tille <tille at debian.org>
Date:   Fri Sep 29 08:39:52 2017 +0200

    New upstream version 3.6-4
---
 DESCRIPTION               |  22 +++
 MD5                       | 283 ++++++++++++++++++++++++++++
 NAMESPACE                 | 181 ++++++++++++++++++
 NEWS                      | 458 ++++++++++++++++++++++++++++++++++++++++++++++
 R/ablineclip.R            |  17 ++
 R/add.ps.R                |   1 +
 R/addtable2plot.R         | 119 ++++++++++++
 R/arctext.R               |  41 +++++
 R/axis.break.R            | 124 +++++++++++++
 R/axis.mult.R             |  37 ++++
 R/barNest.R               |  59 ++++++
 R/barlabels.R             |  23 +++
 R/barp.R                  | 130 +++++++++++++
 R/battleship.plot.R       |  32 ++++
 R/box.heresy.R            |  39 ++++
 R/boxed.labels.R          |  50 +++++
 R/brkdn.plot.R            | 142 ++++++++++++++
 R/brkdnNest.R             | 116 ++++++++++++
 R/bumpchart.R             |  34 ++++
 R/centipede.plot.R        | 101 ++++++++++
 R/clean.args.R            |  21 +++
 R/clplot.R                | 138 ++++++++++++++
 R/cluster.overplot.R      |  34 ++++
 R/color.gradient.R        |   3 +
 R/color.id.R              |   6 +
 R/color.legend.R          |  36 ++++
 R/color.scale.R           |  80 ++++++++
 R/color.scale.lines.R     |  24 +++
 R/color2D.matplot.R       | 133 ++++++++++++++
 R/corner.label.R          |  24 +++
 R/count.overplot.R        |  60 ++++++
 R/cylindrect.R            |  16 ++
 R/dendrite.R              | 100 ++++++++++
 R/dendroPlot.R            |  49 +++++
 R/diamondplot.R           |  85 +++++++++
 R/dispersion.R            |  99 ++++++++++
 R/display.overplot.R      |  76 ++++++++
 R/dotplot.mtb.R           |  60 ++++++
 R/draw.arc.R              |  47 +++++
 R/draw.circle.R           |  14 ++
 R/draw.ellipse.R          |  78 ++++++++
 R/draw.radial.line.R      |  32 ++++
 R/drawNestedBars.R        |  63 +++++++
 R/ehplot.R                |  52 ++++++
 R/election.R              |  27 +++
 R/emptyspace.R            |  79 ++++++++
 R/fan.plot.R              | 113 ++++++++++++
 R/feather.plot.R          |  25 +++
 R/floatpie.R              |  63 +++++++
 R/fullaxis.R              |  18 ++
 R/gantt.R                 | 124 +++++++++++++
 R/gap.barplot.R           |  59 ++++++
 R/gap.boxplot.R           | 102 +++++++++++
 R/gap.plot.R              | 160 ++++++++++++++++
 R/get.tablepos.R          |  60 ++++++
 R/getFigCtr.R             |  12 ++
 R/getIntersectList.R      |  31 ++++
 R/getMarginWidth.R        |  22 +++
 R/getYmult.R              |  14 ++
 R/gradient.rect.R         |  33 ++++
 R/histStack.R             |  37 ++++
 R/intersectDiagram.R      | 138 ++++++++++++++
 R/kiteChart.R             |  87 +++++++++
 R/labbePlot.R             |  44 +++++
 R/ladderplot.R            |   4 +
 R/ladderplot.default.R    |  37 ++++
 R/legendg.R               |  83 +++++++++
 R/lengthKey.R             |  12 ++
 R/makeIntersectList.R     |  66 +++++++
 R/maxEmptyRect.R          |  61 ++++++
 R/multhist.R              |  30 +++
 R/multsymbolbox.R         |  15 ++
 R/p2p_arrows.R            |   5 +
 R/panes.R                 |   8 +
 R/paxis3d.R               | 138 ++++++++++++++
 R/pie3D.R                 | 137 ++++++++++++++
 R/placeLabels.R           |  27 +++
 R/plotCI.R                |  90 +++++++++
 R/plotH.R                 |  33 ++++
 R/plot_bg.R               |   4 +
 R/polygon.shadow.R        |  24 +++
 R/pyramid.plot.R          | 122 ++++++++++++
 R/radial.grid.R           |  44 +++++
 R/radial.pie.R            | 121 ++++++++++++
 R/radial.plot.R           | 210 +++++++++++++++++++++
 R/radial.plot.labels.R    |  22 +++
 R/radialtext.R            |  62 +++++++
 R/raw.means.plot.R        | 209 +++++++++++++++++++++
 R/rectFill.R              |  28 +++
 R/rescale.R               |  24 +++
 R/revaxis.R               |  35 ++++
 R/rm.plot2.R              |  14 ++
 R/ruginv.R                |  37 ++++
 R/size_n_color.R          |  55 ++++++
 R/sizeplot.R              |  19 ++
 R/sizetree.R              |  81 ++++++++
 R/smoothColors.R          |  53 ++++++
 R/soil.texture.R          |  48 +++++
 R/soil.texture.uk.R       |  49 +++++
 R/spread.labels.R         |  71 +++++++
 R/spreadout.R             |  54 ++++++
 R/stackpoly.R             |  54 ++++++
 R/staircase.plot.R        | 120 ++++++++++++
 R/starPie.R               |  43 +++++
 R/staxlab.R               |  47 +++++
 R/std.error.R             |  19 ++
 R/symbolbarplot.R         |  97 ++++++++++
 R/symbolbox.R             |  39 ++++
 R/tab.title.R             |  41 +++++
 R/taylor.diagram.R        | 221 ++++++++++++++++++++++
 R/textbox.R               |  68 +++++++
 R/thigmophobe.R           |  87 +++++++++
 R/triax.R                 | 285 +++++++++++++++++++++++++++++
 R/tsxpos.R                |  16 ++
 R/twoord.plot.R           | 131 +++++++++++++
 R/twoord.stackplot.R      | 165 +++++++++++++++++
 R/vectorField.R           |  37 ++++
 R/weighted.hist.R         |  64 +++++++
 R/windrose.R              |  99 ++++++++++
 R/zoomInPlot.R            |  55 ++++++
 data/death_reg.rda        | Bin 0 -> 1159 bytes
 data/soils.rda            | Bin 0 -> 1610 bytes
 debian/README.test        |   7 -
 debian/changelog          | 132 -------------
 debian/compat             |   1 -
 debian/control            |  40 ----
 debian/copyright          |  34 ----
 debian/rules              |   9 -
 debian/source/format      |   1 -
 debian/upstream/metadata  |  10 -
 debian/watch              |   2 -
 demo/00Index              |   1 +
 demo/plotrix.R            | 387 +++++++++++++++++++++++++++++++++++++++
 inst/CITATION             |  12 ++
 man/ablineclip.Rd         |  47 +++++
 man/add.ps.Rd             | 116 ++++++++++++
 man/addtable2plot.Rd      |  59 ++++++
 man/arctext.Rd            |  55 ++++++
 man/axis.break.Rd         |  47 +++++
 man/axis.mult.Rd          |  47 +++++
 man/barNest.Rd            | 159 ++++++++++++++++
 man/barlabels.Rd          |  45 +++++
 man/barp.Rd               | 151 +++++++++++++++
 man/battleship.plot.Rd    |  48 +++++
 man/bin.wind.records.Rd   |  35 ++++
 man/binciW.Rd             |  28 +++
 man/binciWl.Rd            |  26 +++
 man/binciWu.Rd            |  26 +++
 man/box.heresy.Rd         |  71 +++++++
 man/boxed.labels.Rd       |  73 ++++++++
 man/brkdn.plot.Rd         |  90 +++++++++
 man/brkdnNest.Rd          |  67 +++++++
 man/bumpchart.Rd          |  68 +++++++
 man/categoryReshape.Rd    |  31 ++++
 man/centipede.plot.Rd     |  85 +++++++++
 man/clean.args.Rd         |  35 ++++
 man/clock24.plot.Rd       |  47 +++++
 man/clplot.Rd             |  34 ++++
 man/cluster.overplot.Rd   |  44 +++++
 man/color.axis.Rd         |  23 +++
 man/color.gradient.Rd     |  31 ++++
 man/color.id.Rd           |  25 +++
 man/color.legend.Rd       |  62 +++++++
 man/color.scale.Rd        |  85 +++++++++
 man/color.scale.lines.Rd  |  54 ++++++
 man/color2D.matplot.Rd    | 134 ++++++++++++++
 man/corner.label.Rd       |  38 ++++
 man/count.overplot.Rd     |  31 ++++
 man/cylindrect.Rd         |  39 ++++
 man/death_reg.Rd          |  11 ++
 man/dendroPlot.Rd         |  66 +++++++
 man/diamondplot.Rd        |  28 +++
 man/dispersion.Rd         |  84 +++++++++
 man/do.first.Rd           |  16 ++
 man/dotplot.mtb.Rd        |  60 ++++++
 man/draw.arc.Rd           |  55 ++++++
 man/draw.circle.Rd        |  34 ++++
 man/draw.ellipse.Rd       |  69 +++++++
 man/draw.radial.line.Rd   |  53 ++++++
 man/draw.tilted.sector.Rd |  40 ++++
 man/drawNestedBars.Rd     |  43 +++++
 man/drawSectorAnnulus.Rd  |  23 +++
 man/ehplot.Rd             |  87 +++++++++
 man/election.Rd           |  62 +++++++
 man/emptyspace.Rd         |  38 ++++
 man/fan.plot.Rd           |  54 ++++++
 man/feather.plot.Rd       |  54 ++++++
 man/fill.corner.Rd        |  26 +++
 man/floating.pie.Rd       |  60 ++++++
 man/fullaxis.Rd           |  51 ++++++
 man/furc.Rd               |  36 ++++
 man/gantt.chart.Rd        | 103 +++++++++++
 man/gap.barplot.Rd        |  50 +++++
 man/gap.boxplot.Rd        |  78 ++++++++
 man/gap.plot.Rd           |  87 +++++++++
 man/get.breaks.Rd         |  23 +++
 man/get.gantt.info.Rd     |  29 +++
 man/get.segs.Rd           |  29 +++
 man/get.soil.texture.Rd   |  29 +++
 man/get.tablepos.Rd       |  31 ++++
 man/get.triprop.Rd        |  32 ++++
 man/getFigCtr.Rd          |  26 +++
 man/getIntersectList.Rd   |  51 ++++++
 man/getMarginWidth.Rd     |  36 ++++
 man/getYmult.Rd           |  17 ++
 man/get_axispos3d.Rd      |  19 ++
 man/gradient.rect.Rd      |  41 +++++
 man/hexagon.Rd            |  27 +++
 man/histStack.Rd          |  70 +++++++
 man/intersectDiagram.Rd   | 144 +++++++++++++++
 man/jiggle.Rd             |  33 ++++
 man/kiteChart.Rd          |  93 ++++++++++
 man/labbePlot.Rd          |  65 +++++++
 man/ladderplot.Rd         |  89 +++++++++
 man/legendg.Rd            |  76 ++++++++
 man/lengthKey.Rd          |  32 ++++
 man/listDepth.Rd          |  16 ++
 man/makeDendrite.Rd       |  35 ++++
 man/makeIntersectList.Rd  |  62 +++++++
 man/maxEmptyRect.Rd       |  44 +++++
 man/mtext3d.Rd            |  21 +++
 man/multhist.Rd           |  40 ++++
 man/multsymbolbox.Rd      |  33 ++++
 man/oz.windrose.Rd        |  50 +++++
 man/oz.windrose.legend.Rd |  31 ++++
 man/p2p_arrows.Rd         |  26 +++
 man/panes.Rd              |  86 +++++++++
 man/pasteCols.Rd          |  28 +++
 man/paxis3d.Rd            |  44 +++++
 man/perspx.Rd             |  29 +++
 man/pie.labels.Rd         |  51 ++++++
 man/pie3D.Rd              |  87 +++++++++
 man/pie3D.labels.Rd       |  46 +++++
 man/placeLabels.Rd        |  54 ++++++
 man/plot.dendrite.Rd      |  43 +++++
 man/plotCI.Rd             |  77 ++++++++
 man/plotH.Rd              |  64 +++++++
 man/plot_bg.Rd            |  18 ++
 man/plotrix-package.Rd    |  63 +++++++
 man/polar.plot.Rd         |  47 +++++
 man/polygon.shadow.Rd     |  55 ++++++
 man/print.brklist.Rd      |  29 +++
 man/propbrk.Rd            |  29 +++
 man/psegments3d.Rd        |  21 +++
 man/ptext3d.Rd            |  22 +++
 man/pyramid.plot.Rd       | 124 +++++++++++++
 man/radial.grid.Rd        |  30 +++
 man/radial.pie.Rd         | 103 +++++++++++
 man/radial.plot.Rd        | 166 +++++++++++++++++
 man/radial.plot.labels.Rd |  53 ++++++
 man/radialtext.Rd         |  73 ++++++++
 man/raw.means.plot.Rd     | 362 ++++++++++++++++++++++++++++++++++++
 man/rectFill.Rd           |  36 ++++
 man/rescale.Rd            |  31 ++++
 man/revaxis.Rd            |  40 ++++
 man/ruginv.Rd             |  32 ++++
 man/seats.Rd              |  22 +++
 man/size_n_color.Rd       |  83 +++++++++
 man/sizeplot.Rd           |  41 +++++
 man/sizetree.Rd           | 106 +++++++++++
 man/sliceArray.Rd         |  30 +++
 man/smoothColors.Rd       |  34 ++++
 man/soil.texture.Rd       |  83 +++++++++
 man/soil.texture.uk.Rd    |  88 +++++++++
 man/soils.Rd              |  16 ++
 man/spread.labels.Rd      |  67 +++++++
 man/spreadout.Rd          |  38 ++++
 man/stackpoly.Rd          |  80 ++++++++
 man/staircase.plot.Rd     |  75 ++++++++
 man/starPie.Rd            |  68 +++++++
 man/staxlab.Rd            |  51 ++++++
 man/std.error.Rd          |  22 +++
 man/sumDendrite.Rd        |  21 +++
 man/sumbrk.Rd             |  26 +++
 man/symbolbarplot.Rd      |  51 ++++++
 man/symbolbox.Rd          |  39 ++++
 man/tab.title.Rd          |  42 +++++
 man/taylor.diagram.Rd     |  93 ++++++++++
 man/textbox.Rd            |  67 +++++++
 man/thigmophobe.Rd        |  34 ++++
 man/thigmophobe.labels.Rd |  66 +++++++
 man/triax.abline.Rd       |  42 +++++
 man/triax.fill.Rd         |  40 ++++
 man/triax.frame.Rd        |  42 +++++
 man/triax.plot.Rd         |  88 +++++++++
 man/triax.points.Rd       |  47 +++++
 man/tsxpos.Rd             |  42 +++++
 man/twoord.plot.Rd        | 140 ++++++++++++++
 man/twoord.stackplot.Rd   |  88 +++++++++
 man/valid.n.Rd            |  21 +++
 man/vectorField.Rd        |  64 +++++++
 man/weighted.hist.Rd      |  64 +++++++
 man/zoomInPlot.Rd         |  44 +++++
 293 files changed, 17589 insertions(+), 236 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
new file mode 100755
index 0000000..7a815de
--- /dev/null
+++ b/DESCRIPTION
@@ -0,0 +1,22 @@
+Package: plotrix
+Version: 3.6-4
+Date: 2016-12-19
+Title: Various Plotting Functions
+Author: Jim Lemon, Ben Bolker, Sander Oom,
+	Eduardo Klein, Barry Rowlingson,
+	Hadley Wickham, Anupam Tyagi,
+	Olivier Eterradossi, Gabor Grothendieck,
+	Michael Toews, John Kane, Rolf Turner,
+	Carl Witthoft, Julian Stander, Thomas Petzoldt,
+	Remko Duursma, Elisa Biancotto, Ofir Levy,
+	Christophe Dutang, Peter Solymos, Robby Engelmann, 
+	Michael Hecker, Felix Steinbeck, Hans Borchers,
+	Henrik Singmann, Ted Toal, Derek Ogle
+Maintainer: Jim Lemon <drjimlemon at gmail.com>
+Imports: grDevices, graphics, stats, utils
+Description: Lots of plots, various labeling, axis and color scaling functions.
+License: GPL (>= 2)
+NeedsCompilation: no
+Packaged: 2016-12-30 09:17:16 UTC; root
+Repository: CRAN
+Date/Publication: 2016-12-30 16:27:58
diff --git a/MD5 b/MD5
new file mode 100644
index 0000000..787e95b
--- /dev/null
+++ b/MD5
@@ -0,0 +1,283 @@
+0e97fb23a015acea899e608e3dbde4ac *DESCRIPTION
+8cf582ff40896ea39ac366b1440f5977 *NAMESPACE
+6b576c0b720272d1f55e47bc32f8c420 *NEWS
+2c74abe5f355af8948fa9087f56959c9 *R/ablineclip.R
+54f531a76de0b83b120f3f6a15108f4e *R/add.ps.R
+76f5fc2c4426b0e082293a71976151e0 *R/addtable2plot.R
+1b938b88b8835cc2cd007b75b7321ad1 *R/arctext.R
+fab32acaa7362918ba978d5ea0df6180 *R/axis.break.R
+e8b305523ba68e063cc674adcc66f524 *R/axis.mult.R
+21f4cb17afac59c319d6570d56bb0c9f *R/barNest.R
+94ebceeee14c8e482cb2b91858c4e6e6 *R/barlabels.R
+9e56390451aa2e680bd2fb5e4aa25f8d *R/barp.R
+3293205a5ce0e392f8449846405fe75d *R/battleship.plot.R
+d6c5921fb4ea1945284f4d23dd10c917 *R/box.heresy.R
+d77477c61c4d24eca7251137b17b62aa *R/boxed.labels.R
+e542d7d83dc92d250706baebb5dfd064 *R/brkdn.plot.R
+d27dc1004e0056c0cbbc2c7715e9706f *R/brkdnNest.R
+99340b1fddd5cf81e613058033d73679 *R/bumpchart.R
+f34b066424d85a26ff27d52dc0d9849a *R/centipede.plot.R
+11f91483daa47b2d17ede65741fe6863 *R/clean.args.R
+19e5a990971d1e53823c784bb93ccc92 *R/clplot.R
+0d3ddb4e14698d4bdd25535abbc37b37 *R/cluster.overplot.R
+86952a8e0eff0913d83ed57387d0db35 *R/color.gradient.R
+f1dcc78b243e40ccd379fff2a1ca0590 *R/color.id.R
+7c1e83994ce386af77d3da48b84e1f8d *R/color.legend.R
+4ad90123eae7b3f205f66c9ffaadcd3f *R/color.scale.R
+07941d0c301f5cde9ca2da59e2600cdf *R/color.scale.lines.R
+8300c4819cf2f6b98090df5a95564766 *R/color2D.matplot.R
+b1a4683fbe6a0bd1859453c13b29b264 *R/corner.label.R
+7595c8d33778f6df60d97729f4e16f3e *R/count.overplot.R
+aa20dff9cb6508240f5ffe0b0f62e4d2 *R/cylindrect.R
+e055bee51aa987733e1edcf6af130c29 *R/dendrite.R
+6ddb8ce458b2848f5fe22abb58e2f608 *R/dendroPlot.R
+6ded5907b37e91f755f5c80c1bbd7b81 *R/diamondplot.R
+860c52641bd4b839e2ad6e253bab51d4 *R/dispersion.R
+260f6d56678e337a2466b63ce31e27dd *R/display.overplot.R
+e9e3f23cd4216bb463bf0993f2c604d8 *R/dotplot.mtb.R
+52b5052b1734781b8148077b036982ae *R/draw.arc.R
+f2a99bd058d0dd5bd10a696896bcf1db *R/draw.circle.R
+bfcbf3aff9d82db63603f4773e280e64 *R/draw.ellipse.R
+1a1383ac27b34b7bfa800009969abfc0 *R/draw.radial.line.R
+36db48f20dca62cf756d0958e33a22b0 *R/drawNestedBars.R
+92b383d4c98800cf63c623407dfa77de *R/ehplot.R
+e3fbaf25887012ffb1b0e5b94dfb796a *R/election.R
+5690e7d7fc3795124df5b97a514b9305 *R/emptyspace.R
+be485fa47a06b433fa03396457693e93 *R/fan.plot.R
+bda3e7166adaeffc7b2d2a5686ad924f *R/feather.plot.R
+e6a77d1aefcf7d277dac15139b473c77 *R/floatpie.R
+9d2cc070d1d3eb1c477e3374a42a036c *R/fullaxis.R
+de975c06f448189119ef8e4879c0a934 *R/gantt.R
+26d4b90ccbb2f301c5a965a403ca5c74 *R/gap.barplot.R
+b7328faf89fa18843efb5ec0cb8e9110 *R/gap.boxplot.R
+5943740e4d7782ca89cd172f96568dfe *R/gap.plot.R
+f2c451d076cbcf808802e54b1b39f1e9 *R/get.tablepos.R
+6949cc16ed4e73cc7358684e3ecab02b *R/getFigCtr.R
+30440670860262b4287ee6de35cc675d *R/getIntersectList.R
+f62328458fae81303b94fbb7287175c6 *R/getMarginWidth.R
+67d21436412022723965cff6a8c88177 *R/getYmult.R
+39c5a2ab540444944f48a55f990045e6 *R/gradient.rect.R
+09764fd0be45b01ef35f7bc551a5ecf4 *R/histStack.R
+5a75434b24f5a4682efdc0cfd51bd8dc *R/intersectDiagram.R
+0c0c4a957e0acc1f78cc56f1aef4ac4b *R/kiteChart.R
+d4f22f0d1204a8436c58bef182abbeb4 *R/labbePlot.R
+27982a3d5d4ea2879657c1dc56c9d070 *R/ladderplot.R
+03cb2fbbe0aa70b2cd946262ebfb7813 *R/ladderplot.default.R
+1295c8a724a005b446ba4637a8013586 *R/legendg.R
+f88facb736d50a863537818e29e9098f *R/lengthKey.R
+18a4b16260b37c922a70a6c439909b59 *R/makeIntersectList.R
+83032771e287d63ea164fed14d1977f1 *R/maxEmptyRect.R
+000018eff02dd539f58a75e49ebc3fb8 *R/multhist.R
+0922537b9c49e3cc345347e46e7087b4 *R/multsymbolbox.R
+96972ee73b58d77aa5c074df75d65600 *R/p2p_arrows.R
+53fc688fbe92d2f624a881d24a2745a0 *R/panes.R
+22fdca0307f38bda9b0a654fe308b8d6 *R/paxis3d.R
+fbdb3446eaf9b5479acfa9005247dfbd *R/pie3D.R
+05f32e09e4fc7dbb36c03b155cc81137 *R/placeLabels.R
+b9a64d1b0d4f890dbc817c1172fec476 *R/plotCI.R
+d81ea105e35ed97f34aa697445006b82 *R/plotH.R
+960aae874cd12958dd6dccde3558879d *R/plot_bg.R
+f10e1defb3c27cbd4459f322752389f0 *R/polygon.shadow.R
+3336cc1deb551b8f8b616d9efc0fb9ed *R/pyramid.plot.R
+d7c749797b3049eb3e827c65b649b94d *R/radial.grid.R
+4a39b9cf3f827790062a28bba3dcfda4 *R/radial.pie.R
+f619ffa52ccbca93e4b863805ef4e894 *R/radial.plot.R
+01aef229151813e543eb0aff5cce347f *R/radial.plot.labels.R
+f3ec3c43b07cc3f536c00da149714272 *R/radialtext.R
+53ff928d38ff1c68cf2fbdf09c26f1fb *R/raw.means.plot.R
+65f60a923e476ffd4fbcbdd433152231 *R/rectFill.R
+da39dde9cdb82f81e5f3373588756c59 *R/rescale.R
+0325ce82523cd877ba82c2d72c664ddc *R/revaxis.R
+07d12fe4254d5ca97d9bc747aea667e2 *R/rm.plot2.R
+e761953480126b28a14326faa3cb680c *R/ruginv.R
+94f6212eb3c3dda4532094d0547cee9f *R/size_n_color.R
+ff774605f2db5e411bcef2424909bc79 *R/sizeplot.R
+e7b06c1b1c82384327516614cd5b2307 *R/sizetree.R
+de129c7ed4e840767bbc911fb5256708 *R/smoothColors.R
+f1cf3329798b8c9a63871d5a6817ed2b *R/soil.texture.R
+3da214e101fe17bebd16fb4649a666a8 *R/soil.texture.uk.R
+86a9d362ca31c72a7e1be15add46b3a9 *R/spread.labels.R
+45b113476e355fa9117ee728b8071f2a *R/spreadout.R
+2e36e418ee1b79c69ea92a2b7935855a *R/stackpoly.R
+1476947622a48a0584ddc801394ebbdf *R/staircase.plot.R
+92140017f521faa7596e7e42ef3fd5a6 *R/starPie.R
+9c2ab674d5414a2c06ff0465a8fd20f6 *R/staxlab.R
+aee2eae39690917f1a489cb30122e977 *R/std.error.R
+2f44a7f9539af99f2e91128142d315f0 *R/symbolbarplot.R
+baa253c7a54bcde2837f305ef2b492b4 *R/symbolbox.R
+03fb7639ade1f0447d3630d247adfb12 *R/tab.title.R
+0cee4a8f25e15353f2ae849e6c63ff33 *R/taylor.diagram.R
+0e6fccb0b8e686d8c01b51366d8aacec *R/textbox.R
+0e19d932405569d60b97d7fcca655786 *R/thigmophobe.R
+ed20aff50590ba744f276b1b4da0d3b8 *R/triax.R
+dec059d897186f22ea6815dbd00b9f10 *R/tsxpos.R
+64111d9cb0418d4a2e004ec5b3e9d143 *R/twoord.plot.R
+580be3c65f98df81f92dff1eff5e671c *R/twoord.stackplot.R
+5f66f535cd59fbe5273f85b976c294e1 *R/vectorField.R
+cdcdd0cd94badf90f50620c73d576c0c *R/weighted.hist.R
+481b3f85c721c582bc955c5059ba7c1e *R/windrose.R
+52d0de3c89b6d90fe1e9157b0c76f291 *R/zoomInPlot.R
+6c5b0047d50b0d071c9a8162c81ccb31 *data/death_reg.rda
+3a3f3ba6dc64626db1c7b2b0b5b25e70 *data/soils.rda
+afe626471214438383c01dfcc2a12e10 *demo/00Index
+b63714a560c191b58a1a659e3c98604d *demo/plotrix.R
+b35ca73e819dbad59881960986301ef3 *inst/CITATION
+f13b4b048731bb65adabe2be9610ecb7 *man/ablineclip.Rd
+537da0d23075efb4f8a3632aa39f3901 *man/add.ps.Rd
+9eee36ce9e1b11859d11f4cd0f713f96 *man/addtable2plot.Rd
+cf79bc5cc57fa626df9fc1b8e629921a *man/arctext.Rd
+f3fbc2cf0c4cb7aaa71d074dc59e6d60 *man/axis.break.Rd
+282b2f8fcd742e3d6a60ab081aaa405b *man/axis.mult.Rd
+06a38f7ed19d404411e088e5f64e0665 *man/barNest.Rd
+0e0e139faa3faf1cbcd989eea0081a3b *man/barlabels.Rd
+cbcf01934c6148ec20aef47077a82bce *man/barp.Rd
+13a6e1f637b62476def20eece0eded3d *man/battleship.plot.Rd
+898f3abab9664c2f87d1a527f622e6ba *man/bin.wind.records.Rd
+95aa3fa95caa2363648ac7fe3c0c370d *man/binciW.Rd
+399bd24635823861f7157e5dd758d19a *man/binciWl.Rd
+ce6a7a21766880d71efe042eb039e7f6 *man/binciWu.Rd
+5b29d6e7ff1720693ee3666d19e5938c *man/box.heresy.Rd
+6f218d69cf8ba86a10cc976a50652329 *man/boxed.labels.Rd
+332e8ded50b760f79a08e80e093d3d32 *man/brkdn.plot.Rd
+cf4596e29fe0c81f3abc405a9176ad81 *man/brkdnNest.Rd
+190ace3439edbc4c1fe28dd3fb828fc1 *man/bumpchart.Rd
+fdd959e735ce69d626bc683c7142a487 *man/categoryReshape.Rd
+e57177261b61c4ef3b8caf59dbda3091 *man/centipede.plot.Rd
+d6019ca90bd3aaaff4e63d9b55aff24c *man/clean.args.Rd
+1bc6d1ec34fe3f534f8e87e8a9c0c6c6 *man/clock24.plot.Rd
+dc4c200cb331f0490d5ce7ee0975534d *man/clplot.Rd
+d8ebaeda4ed4a0af0ee365fc75ddd28a *man/cluster.overplot.Rd
+6322f0d88a0098ecf7de26b6add180e4 *man/color.axis.Rd
+4108e162137a9083bd347763abbd63d7 *man/color.gradient.Rd
+5f2c9fa598ebecc3e78595a2c8d63252 *man/color.id.Rd
+e11a8f667843c9ee5697b3604722dbf1 *man/color.legend.Rd
+e6030eedf6130785be0735a4e7778c30 *man/color.scale.Rd
+45e516c607c3f1d3b7766595015d514c *man/color.scale.lines.Rd
+e34fb4aeb5b8fec7d9f2e5bacf1c5de8 *man/color2D.matplot.Rd
+51cd6dbe551abddadcf23f297b3fcef9 *man/corner.label.Rd
+35453606f45c916c9b5f77020c3c3b0c *man/count.overplot.Rd
+b6bc308f4d4d62c4302afddb22666411 *man/cylindrect.Rd
+403fec7cba6c01095a718a8503001bac *man/death_reg.Rd
+afb5f5ce1e6dbc78e8843df397f2f10c *man/dendroPlot.Rd
+470583ce423fd9c05502a784d10114eb *man/diamondplot.Rd
+1780eb1f4a06114e83870dd1de250ce8 *man/dispersion.Rd
+316cbd9616959d741b2ecbe6ec3254cd *man/do.first.Rd
+aae69bd515cac9d9ebdc8d89759b4029 *man/dotplot.mtb.Rd
+cb68dd72282e0a252f1689d786a10371 *man/draw.arc.Rd
+b24a1bf68bf35cfa467a648040003df5 *man/draw.circle.Rd
+4a4c1b00cab07fbe4a3d426c9e99ed6f *man/draw.ellipse.Rd
+84e9daf9df6dc02632d28aad82fe552e *man/draw.radial.line.Rd
+c771ff20c909ba6d894c1dd73499b079 *man/draw.tilted.sector.Rd
+5008fddaa27f126c13839b2ea3b4cb7e *man/drawNestedBars.Rd
+e0cf4b49c5d11ec218ef091e3766443c *man/drawSectorAnnulus.Rd
+6a042c43698809a86ca34bca4bbad53d *man/ehplot.Rd
+3d1a40efc7bc84da1c6d4b59b7161c4b *man/election.Rd
+4eb5b9648e8de073082c4d98fbb108af *man/emptyspace.Rd
+4ee490709973efd8b4280377d9b62aab *man/fan.plot.Rd
+fffabb21a837f2c1263dc71d2911f3d0 *man/feather.plot.Rd
+7fc047f882280b8673a96f6d21b9a1d9 *man/fill.corner.Rd
+76b772c9da227812f734f66cfe7c3331 *man/floating.pie.Rd
+ef0018a2314c3b5bf4d0e953ae036aed *man/fullaxis.Rd
+57c7a78552ca7cbc5d3d5afc3851b70e *man/furc.Rd
+081e9bab5cd97a5cc874488ffb9447a6 *man/gantt.chart.Rd
+4ac19f9bcfde71dd07c1326d6750b1ed *man/gap.barplot.Rd
+0fe07939aca17dfbac6226843ed189d1 *man/gap.boxplot.Rd
+32e58044c651a2949554e2ca6a8a8e5f *man/gap.plot.Rd
+2bfcd82c9e1bc208fade58833094861e *man/get.breaks.Rd
+df2bdbf654df6eab3ee5e96f846efc03 *man/get.gantt.info.Rd
+da679d8d83c5d75989816ea3f652e46f *man/get.segs.Rd
+78207c9f46ee81fd350f075caf163c7c *man/get.soil.texture.Rd
+7c308ff4259d4b2e6df08295a3ebeb31 *man/get.tablepos.Rd
+b38bf1ec364fc7e0d352d23949ff09d8 *man/get.triprop.Rd
+59ce154c27e79c8655eb15c56abdb8fe *man/getFigCtr.Rd
+1093b6fc68dc03a6ec675766b3b240a6 *man/getIntersectList.Rd
+66e9bac85163b66dbe998ef0d6e23410 *man/getMarginWidth.Rd
+254cdccb0ea6f62f3c192a1f36ec7b4d *man/getYmult.Rd
+81b41e59e8fdb64a7819ee5e5a1bad56 *man/get_axispos3d.Rd
+165ea94083e1eaf7285da55db8094314 *man/gradient.rect.Rd
+722a32a1697eac6a2d3d1b656c9e91a1 *man/hexagon.Rd
+22245bc76aae5426664addcec8114c43 *man/histStack.Rd
+a63853e93a6fbab6cf1ea8b7c2e9e0c9 *man/intersectDiagram.Rd
+970087f83b357355eb675516f4689bfe *man/jiggle.Rd
+055fb77f6c128cd174b0e3620ae82e8e *man/kiteChart.Rd
+47d8e24c27f66b5d9bb08cec09bcee56 *man/labbePlot.Rd
+ea06b6e8b663a57af433a17c15721e2f *man/ladderplot.Rd
+89aa2add323d7ed77ee1f7c8014f20c7 *man/legendg.Rd
+1087aef8002dcf7dd3c93309aa1e37fc *man/lengthKey.Rd
+918f9ec4e06c9d8796e26c5fe0b2d39e *man/listDepth.Rd
+e108e4437e6471fa37c1ca95e96e3965 *man/makeDendrite.Rd
+9d914bed93776844a53767ab40525a6f *man/makeIntersectList.Rd
+4bf0a63a5ee0f446c2dd210ebd97b726 *man/maxEmptyRect.Rd
+4bb726d76edd975db9258cd700783dcc *man/mtext3d.Rd
+3c782a3683c1e4d09c2a178116f5421d *man/multhist.Rd
+a6b1e2596340a535c74848aeffe98833 *man/multsymbolbox.Rd
+41c1c83e66a33d35bb0f48d9dfd68909 *man/oz.windrose.Rd
+00585c01256159f892de1181dd9f63f3 *man/oz.windrose.legend.Rd
+6858a19ebe31e922e871d0a66ef5be43 *man/p2p_arrows.Rd
+f5f9a3f8fc633f528b69502756b032fe *man/panes.Rd
+e64d53c83bcdabd46565c0ebee38e23c *man/pasteCols.Rd
+df16d5a7e051f52e37eb2624bed0abf2 *man/paxis3d.Rd
+024a5c644d2982a431cebaa10fd2131f *man/perspx.Rd
+a89c6ca83e82949f9fbfdf04a8cc96b2 *man/pie.labels.Rd
+6611561a873f31307e7de20c63a304f7 *man/pie3D.Rd
+9209e3496d57207f40745b435e473b03 *man/pie3D.labels.Rd
+34eaf73d08569f68d5f54156b3b907cf *man/placeLabels.Rd
+6a49a451410e67292fd9dd0e90853b3e *man/plot.dendrite.Rd
+94da9e98fdf1f64739b188fea1f021f6 *man/plotCI.Rd
+64665bf5d11d49c15c04393ae0a8fe7f *man/plotH.Rd
+d0be8d8872d21c55c387ed117d60bc92 *man/plot_bg.Rd
+e9e90cae7833bc7fe11f0795ec01cd28 *man/plotrix-package.Rd
+31556e9a35a48fbccdff23395a8cdb07 *man/polar.plot.Rd
+aacd4acbdc1275ecff45c6d962ae8f16 *man/polygon.shadow.Rd
+8d1dc46509d56126301ed969bff3ed8c *man/print.brklist.Rd
+3624e09ffd23b05f6681cc1c31734345 *man/propbrk.Rd
+d3979b4cb2e49006ebd6bc1e2c795fb9 *man/psegments3d.Rd
+a239386f59c013ebc0e4bf9fcabc5747 *man/ptext3d.Rd
+dddf2ba43c782b71e5a155e6a4b2abe5 *man/pyramid.plot.Rd
+a077966650ff8698ef0c799e281a826e *man/radial.grid.Rd
+e1ecf218a7dd9d4b5bec2a491a079982 *man/radial.pie.Rd
+c035013cce6aa4827e14ab1bfc41cbf9 *man/radial.plot.Rd
+7d2279ed398dc0600793cb09d86a71bc *man/radial.plot.labels.Rd
+9e52803106c4336f54b18549a02a99d2 *man/radialtext.Rd
+d442e353076ad725947c6e2e6057fa98 *man/raw.means.plot.Rd
+12483f6f1bca2cc5501598e3e4a98aed *man/rectFill.Rd
+c4f2c015fcd5a98581ef7859a1640e5a *man/rescale.Rd
+806b61300d1880bdd26a85011d845714 *man/revaxis.Rd
+e707694b2762db46d4e938f3383b5577 *man/ruginv.Rd
+263fe882f280cc6bb721db6f9abf5e10 *man/seats.Rd
+44fac82cd667819d0f167299987c4fcf *man/size_n_color.Rd
+f2586a13028c3884bdc4335610c67dc9 *man/sizeplot.Rd
+5e3eaf86657a5d098e9c9c53e783d689 *man/sizetree.Rd
+554e180d9da267bedc3ad04b2bd6f4aa *man/sliceArray.Rd
+1b6f61faec620b2a1cc2b4c1b95fcc7e *man/smoothColors.Rd
+d3a29fca855fdced8e042681255cd481 *man/soil.texture.Rd
+56b0e186a2d31d3f9c4f5a38f54540df *man/soil.texture.uk.Rd
+1538a56e8001fbdac5bc6fe59989cb75 *man/soils.Rd
+94621600224164995f082b46963b8f87 *man/spread.labels.Rd
+68ecac1afb03f4f889768018295f8a2c *man/spreadout.Rd
+67b5e4985491c2c0d6613aac7f25fe1c *man/stackpoly.Rd
+c2ce7111858d31a7b5f06edd041ef529 *man/staircase.plot.Rd
+13f237779bc123645ee131e980706d31 *man/starPie.Rd
+df4893370735f220266cab0699133250 *man/staxlab.Rd
+40286c6064e6b9e29ba37f06058b89df *man/std.error.Rd
+c02fd1aaeea9441f1b8e8790cadd3d58 *man/sumDendrite.Rd
+38d5ea8f92b0d3075828ef204d808eaf *man/sumbrk.Rd
+ef9a85ac60b082897b7a8c3a8c9892ee *man/symbolbarplot.Rd
+ae8f69cda8160327316c915a992151c9 *man/symbolbox.Rd
+d9f79a0e522fcb9a4d1af0873723a412 *man/tab.title.Rd
+cbc39b26a24639a81dd65defa94c7817 *man/taylor.diagram.Rd
+78e9845825dfde81846bdca59142da45 *man/textbox.Rd
+435910f39b3e5a2b60fb8906aa45e390 *man/thigmophobe.Rd
+4f7a77bbf7f29248928acc1e22ab25a3 *man/thigmophobe.labels.Rd
+ac5071d4a906c8d08c62d24c1059d548 *man/triax.abline.Rd
+5fc757905ff2fb69baab63abdba3d364 *man/triax.fill.Rd
+ef26303ff7d7fca80a4e6aa6a4faface *man/triax.frame.Rd
+fc7ea4a90434e5b05a28e1be6b00c0ef *man/triax.plot.Rd
+cae9faa9c12feab91f4b7e3a03eb02f3 *man/triax.points.Rd
+d0def030f355745d885dcabf7e1beb2e *man/tsxpos.Rd
+88d19cd56964360cf9e8efa5c7e4f4ff *man/twoord.plot.Rd
+4b0b895d4f207d31f039876eee86c956 *man/twoord.stackplot.Rd
+517c4cd06972f8ccde88ccd063e40dd1 *man/valid.n.Rd
+fec04eee273289a8f3cc6c1ab2c74741 *man/vectorField.Rd
+da967637efe92ac080392fe7a08c8639 *man/weighted.hist.Rd
+2ac8767af5192740723f42558d4486e9 *man/zoomInPlot.Rd
diff --git a/NAMESPACE b/NAMESPACE
new file mode 100644
index 0000000..627b003
--- /dev/null
+++ b/NAMESPACE
@@ -0,0 +1,181 @@
+# created 5/9/2011 - Jim Lemon
+ importFrom("grDevices", "col2rgb", "colors", "dev.cur", "dev.list",
+    "dev.size", "gray", "heat.colors", "palette", "rainbow",
+    "rgb", "trans3d", "xy.coords")
+ importFrom("graphics", "abline", "arrows", "axTicks", "axis",
+    "axis.POSIXct", "barplot", "barplot.default", "box",
+    "boxplot", "clip", "hist", "hist.default", "layout",
+    "legend", "lines", "locator", "matplot", "mtext", "par",
+    "persp", "plot", "plot.new", "plot.window", "points",
+    "polygon", "rect", "segments", "strheight",
+    "strwidth", "symbols", "text", "title", "xinch", "yinch")
+ importFrom("stats", "aggregate", "approx", "as.formula",
+    "complete.cases", "cor", "dist", "model.frame", "na.omit",
+    "qnorm", "sd", "t.test", "terms")
+ importFrom("utils", "combn", "modifyList")
+export(
+ ablineclip,
+ addtable2plot,
+ add.ps,
+ arctext,
+ axis.break,
+ axis.mult,
+ barlabels,
+ barNest,
+ barp,
+ battleship.plot,
+ bin.wind.records,
+ binciW,
+ binciWl,
+ binciWu,
+ box.heresy,
+ boxed.labels,
+ brkdn.plot,
+ brkdnNest,
+ bumpchart,
+ categoryReshape,
+ centipede.plot,
+ clean.args,
+ clock24.plot,
+ clplot,
+ cluster.overplot,
+ color.axis,
+ color.gradient,
+ color.id,
+ color.legend,
+ color.scale,
+ color.scale.lines,
+ color2D.matplot,
+ corner.label,
+ count.overplot,
+ cylindrect,
+ dendroPlot,
+ diamondplot,
+ dispersion,
+ dotplot.mtb,
+ draw.arc,
+ draw.circle,
+ draw.ellipse,
+ draw.radial.line,
+ draw.tilted.sector,
+ drawNestedBars,
+ drawSectorAnnulus,
+ ehplot,
+ election,
+ emptyspace,
+ fan.plot,
+ feather.plot,
+ fill.corner,
+ floating.pie,
+ fullaxis,
+ furc,
+ gantt.chart,
+ gap.barplot,
+ gap.boxplot,
+ gap.plot,
+ get.breaks,
+ get.gantt.info,
+ get.segs,
+ get.soil.texture,
+ get.tablepos,
+ get.triprop,
+ getFigCtr,
+ getIntersectList,
+ getMarginWidth,
+ getYmult,
+ gradient.rect,
+ hexagon,
+ histStack,
+ intersectDiagram,
+ jiggle,
+ kiteChart,
+ labbePlot,
+ ladderplot,
+ ladderplot.default,
+ legendg,
+ lengthKey,
+ listDepth,
+ makeDendrite,
+ makeIntersectList,
+ maxEmptyRect,
+ mtext3d,
+ multhist,
+ multsymbolbox,
+ oz.windrose,
+ oz.windrose.legend,
+ p2p_arrows,
+ panes,
+ pasteCols,
+ paxis3d,
+ perspx,
+ pie.labels,
+ pie3D,
+ pie3D.labels,
+ placeLabels,
+ plot.dendrite,
+ plot_bg,
+ plotCI,
+ plotH,
+ polar.plot,
+ polygon.shadow,
+ propbrk,
+ psegments3d,
+ ptext3d,
+ pyramid.plot,
+ radial.grid,
+ radial.pie,
+ radial.plot,
+ radial.plot.labels,
+ radialtext,
+ raw.means.plot,
+ raw.means.plot2,
+ rectFill,
+ remove.args,
+ rescale,
+ revaxis,
+ ruginv,
+ seats,
+ size_n_color,
+ sizeplot,
+ sizetree,
+ sliceArray,
+ smoothColors,
+ soil.texture,
+ soil.texture.uk,
+ spread.labels,
+ spreadout,
+ stackpoly,
+ staircase.plot,
+ starPie,
+ staxlab,
+ std.error,
+ sumDendrite,
+ sumbrk,
+ symbolbarplot,
+ symbolbox,
+ tab.title,
+ taylor.diagram,
+ textbox,
+ thigmophobe,
+ thigmophobe.labels,
+ triax.abline,
+ triax.fill,
+ triax.frame,
+ triax.plot,
+ triax.points,
+ tsxpos,
+ twoord.plot,
+ twoord.stackplot,
+ valid.n,
+ vectorField,
+ weighted.hist,
+ zoomInPlot
+)
+# methods
+S3method(plot,dendrite)
+S3method(print,brklist)
+S3method(histStack,default)
+S3method(histStack,formula)
+S3method(plotH,formula)
+S3method(plotH,default)
+S3method(ladderplot,default)
diff --git a/NEWS b/NEWS
new file mode 100755
index 0000000..f6be909
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,458 @@
+version 3.6-4
+
+        fixed a typo in twoord.plot that caused an error when the range
+        of the right axis went negative
+        added the jiggle function
+        changed the show.nulls argument in intersectDiagram to the nulls label
+        fixed the "fill" problem in textbox (thanks to Kohleth Chia)
+        added the placeLabels function
+        enhancement to raw.means.plot (thanks to Henrik Singmann)
+        added the binciW function, which fixes an error (thanks to Marc Girondot)
+        fixed the bug with displaying dispersion in barNest
+
+version 3.6-3
+
+        fixed the errant y label in radial.pie
+        fixed the problem with degrees/radians in draw.ellipse (thanks to Wouter vander Bijl)
+
+version 3.6-2
+
+        fixed the call to clip in rectFill (thanks to Cheng Zhou)
+        fixed the incorrect placing of some text in arctext (thanks to Mark Heckmann)
+        fixed the misbehaving y axis in brkdn.plot
+        improved the circumferential labels in clock24.plot
+
+version 3.6-1
+
+	updated ehplot function (thanks to Robby Englemann)
+	pyramid.plot now displays trailing zeros (thanks to Simon Thornley)
+	problem with time/date x values in vectorField fixed
+	colors and staggering added to plot.dendrite (thanks to Marna Wagley)
+
+version 3.6
+
+	fixed the missing left axis ticks in pyramid.plot (thanks to Jacob Clark)
+	corrected addtable2plot for log y plots (thanks to Andrew Metcalfe)
+	made the axis label and axis tick expansions the same in twoord.plot (thanks to wxj)
+	made the axis label and tick labels the same color as the axis in twoord.plot
+	added stack labels to the sizetree function
+	added imports now necessary for R CMD check
+
+version 3.5-12
+
+	added choice of time axis (1 or 3) to gantt.chart (thanks to Mathias Collins)
+	added outlined error bars to the dispersion function (thanks to Michael Eisenring)
+	added a check for no variation in values to color.scale and color2D.matplot (thanks to Diego Calzolari)
+
+version 3.5-11
+
+	changed my email address
+
+version 3.5-10
+
+	added calculation method for SD in taylor.diagram (thanks to Melanie Moeller)
+	added the assembly seat distribution functions "seats" and "election"
+	  (thanks to Barry Rowlingson and Duncan Murdoch)
+	fixed the rectangle border problem in legendg (thanks to Christian Graul)
+
+version 3.5-9
+
+	added tangential labels to radial.plot
+
+version 3.5-8
+
+	fixed the line length bug in feather.plot (thanks to Dr. Kazama)
+
+version 3.5-6
+
+	added optional radial lines to the radial.grid function (thanks to Darren Obbard)
+
+version 3.5-5
+
+	fixed the radial label bug in the radial.* functions (thanks to Mayeul Kauffmann)
+	changed the circumferential label suppress value in the radial.* functions to NULL
+	added the color.axis function
+	added log correction for boxed.labels (thanks to Flemming Skjøth)
+	fixed the breaks bug in histStack.default (thanks to Derek Ogle)
+	added scaled bar widths to barNest
+
+version 3.5-3
+
+	fixed the problems with data frames and margins in battleship.plot (thanks to David Carlson)
+	set xpd=TRUE for the boxed.labels function (thanks to Francois Rousseu)
+	changed the pie.labels function to call text and adjust in x and y
+	added plain text labelling to pie.labels
+	tested for a current device in cluster.overplot and count.overplot (thanks to Markus Elze)
+
+version 3.5-2
+
+	added the get.tablepos function (thanks to Peter Murakami)
+	passed the ... argument(s) to points and dispersion in brkdn.plot (thanks to Peter Mandeville)
+	added text adjustment for the circumferential labels to radial.plot
+	added the fill.corner function to do waffle plots (thanks to Zhao Jin)
+
+version 3.5-1
+
+	added the tsxpos function (thanks to Prof J C Nash)
+	added a warning for off-axis labels to staxlab (thanks again to Prof Nash)
+	added the arrows argument to bumpchart (thanks to Jie)
+	added the axes argument to gap.boxplot (thanks to Shane Carey)
+
+version 3.4-8
+
+	fixed a minor bug in the ylim argument of gap.plot
+	twoord.plot had some bugs cleaned up and now has a do.first argument
+	fixed the missing background colors in addtable2plot
+	allowed floating.pie to ignore zero and NA values (thanks to Jose deSantos)
+	added the "stax" argument to gap.plot (thanks to Zheng Lu)
+	fixed the problem with "yaxlab" in gap.barplot (thanks to Giorgio Galetti)
+	added the "histStack" and "plotH" functions (thanks to Derek Ogle)
+
+version 3.4-7
+
+	added automatic spreading out to pie.labels
+	fixed the "priorities extremes" bug in gantt.chart (thanks to Michael Motta)
+	pyramid.plot now accepts NA values (thanks to Susumu Tanimura)
+	radial.plot now does a rank clock plot (thanks to Don Dennerline)
+
+version 3.4-6
+
+	fixed the kite line positioning in kiteChart (thanks to Justin Dellinger)
+
+version 3.4-5
+
+	fixed the upside down character bug in arctext
+	fixed the typo in the demo function for kite chart
+
+version 3.4-4
+
+	added the radial.grid function to the NAMESPACE
+
+version 3.4-3
+
+	minor bug that counted NAs in the propbrk function fixed
+
+version 3.4-2
+
+	Character spacing and placement improved in draw.arc and arctext (thanks to Ted Toal)
+	radialtext and draw.radial.line functions added (also thanks to Ted Toal)
+	weighted.hist now allows a custom X axis to be displayed (thanks to Ben Graf)
+	Added the barlabels function
+
+version 3.4-1
+
+	Fixed the alignment problem in pie3D and rationalized angle increments
+	Added the raw.means.plot functions contributed by Henrik Singmann
+	vastly improved the speed of the sizetree function
+	added the "varpos" argument to the kiteChart function - thanks to Nikolaus Lampardariou)
+
+version 3.4
+
+	added the border argument to the sizetree function
+	multhist now returns all values from hist - thanks to John Muccigrosso
+	fixed a bug in addtable2plot that appeared on plots with a log x axis
+	fixed an almost invisible bug in drawSectorAnnulus - thanks to Denes
+	added the "mar" argument to pie3D - thanks to Qinghua Zhao
+
+version 3.3-9
+
+	Fixed the bug in centipede.plot that I introduced in v3.3-8
+
+version 3.3-8
+
+	added the horizontal grid argument to centipede plot (thanks to Colin Wahl)
+
+version 3.3-7
+
+	Fixed a color bug in plotCI (thanks to Daniel Wollschlaeger)
+
+version 3.3-6
+
+	Added the battleship plot (or Ford curve) thanks to Adam Maltese
+	Added the box.heresy function - thanks to Gianni Lavaredo
+
+version 3.3-4
+
+	Added the display.na argument to the dispersion function (thanks to Lasse Jacobsen)
+	Removed the "Overall" bar in barNest when counts are being displayed
+
+version 3.3-3
+
+	Fixed a bug in the Hinton diagram option (thanks to Xavier Fernández i Marín)
+
+version 3.3-2
+
+	color2D.matplot will now display a Hinton diagram
+	added padding for negative values in twoord.plot (thanks to Hans Borcher)
+	added the maxEmptyRect function (thanks again to Hans Borchers)
+
+version 3.3-1
+
+	expanded the color options and added top labels in sizetree
+	returned the frequency calculation in weighted.hist to what it used to be
+
+version 3.3
+
+	fixed the vertical lines color in addtable2plot
+	fixed the frequency calculation in weighted.hist (thanks to Jarad Niemi)
+	added the size_n_color plot
+
+version 3.2-8
+
+	added partitioning of intersections to intersectDiagram
+
+version 3.2-7
+
+	bug fix for the examples in ladderplot
+
+version 3.2-6
+
+	added the ruginv function after fixing some encoding problems
+
+version 3.2-5
+
+	fixed a color assignment problem in plotCI
+	added automatic color assignment in sizetree where all levels use the same colors
+
+version 3.2-4
+
+	Fixed the missing "shade" argument in pie3D (thanks to Jesse Brown)
+	Added specifiable priority legend label and extreme descriptors
+		(thanks to Pedro Reis)
+	Added the (experimental) radial.pie function
+
+version 3.2-3
+
+	Fixed a few warnings from CRAN check (dotplot.mtb, gap.boxplot, symbolbarplot)
+	Added the ruginv function (thanks to Peter Solymos)
+
+version 3.2-2
+
+	Added the labbePlot function (thanks to Whitney Melroy)
+	Fixed the showall argument problem in the barNest function
+	Fixed the problem with data frame input in the intersectDiagram function
+
+version 3.2-1
+
+	Added the sumbrk function to brkdnNest (thanks to Kevin Burnham)
+	The dispbars function (just a call to dispersion) is now gone
+	Added user specified text colors to boxed.labels (thanks to Thorn Thaler)
+	Added the ehplot function (thanks to Robby, Michael & Felix)
+
+version 3.2
+
+	Rewrote intersectDiagram to use equidistant spacing
+	Fixed a warning in oz.windrose.legend
+	Fixed default ordinate scaling in twoord.plot
+	Major rewrite of brkdnNest, barNest and drawNestedBars functions
+	Major rewrite of color.scale function
+	Added sliceArray function for barNest due to the above rewrite
+
+version 3.1-2
+
+	Fixed a minor bug in intersectDiagram
+
+version 3.1-1
+
+	Border colors added to gantt.chart (thanks to Brandon Fessler)
+	Extensive rewrite of the intersectDiagram function and helpers
+	Rewrite of the dendroPlot function
+	categoryReshape function added
+
+version 3.1
+
+	intersectDiagram zero instance levels fixed
+	intersectDiagram now invisibly returns the list of intersections
+	Spacing within levels in intersectDiagram simplified
+	makeIntersectList now discards empty levels of intersection
+	makeIntersectList color assignment fixed
+	dendroPlot function added
+
+version 3.0-9
+
+	Fixed the priority coloring problem in gantt.chart
+	Added optional vertical lines to addtable2plot (thanks to Bill Sperry)
+	Fixed the overshooting y axis for certain values of y in barp
+
+version 3.0-8
+
+	Added semi-intelligent cell labelling to the color2D.matplot function
+
+version 3.0-7
+
+	Fixed the right ordinate alignment in twoord.plot
+
+version 3.0-6
+
+	Added the "barlabels" argument to drawNestedBars
+	big fix for the makeDendrite, furc and plot.dendrite functions
+
+version 3.0-5
+
+	added Christophe Dutang's fix for the twoord.stackpoly function
+	fixed the confidence limit problem in barNest (I sincerely hope)
+
+version 3.0-4
+
+	added semi-intelligent bar labelling to the sizetree function
+	added yaxs="i" to the empty plot in twoord.plot (thanks to Giles Crane)
+	added the Wilson binomial CI functions for brkdnNest
+
+version 3.0-3
+
+	added the ladderplot function (thanks to Peter Solymos)
+
+version 3.0-2
+
+	rewrote intersectDiagram to better display missing intersections
+	added a correction for character expansion to boxed.labels
+	fixed the count method for barNest
+
+version 3.0-1
+
+	competely rewrote the barNest family of functions
+	removed labels for empty sets in intersectDiagram
+
+version 3.0
+
+	fixed some minor problems with oz.windrose (thanks to Brad Evans)
+	added a 'locator' option to zoomInPlot (thanks to Greg Snow)
+	added the 'padj' argument to stackpoly for more tick label control
+	made the 'srt' argument work for both x and y axes in staxlab
+	fixed two little bugs in thigmophobe (thanks to Stephen Milborrow)
+	added the 'add' argument to radial.plot (thanks to Evan Daugharthy)
+
+version 2.9-5
+
+	added the kiteChart function
+	added the "pos" argument to the getFigCtr function
+
+version 2.9-4
+
+	added a calculated default vector of axis tick positions to twoord.plot
+	added a "mar" argument to the taylor.diagram function
+
+version 2.9-3
+
+	added the gamma.col argument to taylor.diagram (thanks to Julian Arnold)
+	added the radial.labels function (thanks to Tali Vardi)
+	added the multiple colors per labels to gantt.chart (thanks to Nicolas Immelman)
+	added the rectFill function
+	added an option to the barp function to use rectFill
+
+version 2.9-2
+
+	fixed the margin problem in staircase.plot
+	fixed the default y-axis tick placement in barp
+
+version 2.9-1
+
+	fixed the "big gap" problem in the gap.plot function
+	added the twoord.stackplot function (thanks to Christophe Dutang)
+
+version 2.9
+
+	added the panes function
+	fixed the border bug in color2D.matplot
+	fixed the indexing bug in drawNestedBars
+
+version 2.8-4
+
+	added the triax.fill function which necessitated...
+	changed the initial plot call from triax.frame to triax.plot
+	removed the "main" argument from triax.frame
+	added brkdnNest to replace hierobrk
+	rewrote barNest to suit brkdnNest
+	added drawNestedBars for the display of barNest
+	changed all remaining hierobarp functions to barNest
+
+version 2.8-3
+
+	radical rewrite of the pyramid.plot function
+	fixed up barp example mistake
+	fixed the title position in zoomInPlot
+	rewrote the hierobarp function as barNest
+
+version 2.8-2
+
+	added the label.cex argument to the gantt.chart function
+	changed the name of the hierobarp function to barNest
+
+version 2.8-1
+
+	added the calculation of proportions to hierobarp
+
+version 2.8
+
+	added the cex argument to the staircase.plot function
+	added a bit to the plotCI function examples
+	changed \code tags to \samp and removed formatting from \link tags
+	added the ylog argument to the barp function (thanks to Fatima Kreusch)
+	added the legendg function (thanks to Primoz Peterlin)
+	removed the Piper diagram functions until they run correctly
+
+version 2.7-2
+
+	added the axislab.cex argument to the twoord.plot function
+
+version 2.7-1
+
+	added the getMarginWidth function
+	added the bracketing lines and labels to hierobarp
+	added the hierobarp.svymean and hierobarp.svyprop functions
+	added the lwd argument to stackpoly (thanks to Vaclav Varvarovsky)
+	included an example to show how to use gantt.chart without dates
+	included an example of histogram + density curve in twoord.plot
+
+version 2.7
+
+	added the getFigCtr function
+	removed the final grouping lines from hierobarp
+
+version 2.6-4
+
+	fixed the bug in hierobrk and hierobarp that got the order of
+	  breakdown factors wrong
+
+version 2.6-3
+
+	fixed the bug in gap.plot that lost the high values
+
+version 2.6-2
+
+	complete rewrite of the hierobarp and hierobrk functions
+	rewrite of barhier function and name changed to sizetree
+
+version 2.6-1
+
+	Minor bug fix in the gap.plot function.
+
+Version 2.6
+
+	Improved bar/line plotting in the twoord.plot function.
+	Added the fullaxis function.
+
+version 2.5-5
+
+	Changed the default symbol in count.overplot to "1".
+	Added bar plotting to the twoord.plot function.
+	Added fill between the confidence lines to the dispersion function.
+	Added the bumpchart function.
+	 (Thanks to Andreas Christofferson for the idea)
+	Added the spreadout function to spread out cramped labels.
+	Added table cell size correction for the cex argument.
+	 (Thanks to Brian Diggs for the patch)
+
+version 2.5-4
+
+	Fixed the bug in dotplot.mtb function.
+	
+version 2.5-3
+
+	Introduced the hierobarp function.
+	Introduced the zoomInPlot function.
+	New version of dotplot.mtb (with bug)
+	
+previous versions
+
+	You don't expect me to remember all that, do you?
diff --git a/R/ablineclip.R b/R/ablineclip.R
new file mode 100755
index 0000000..029c790
--- /dev/null
+++ b/R/ablineclip.R
@@ -0,0 +1,17 @@
+ablineclip<-function(a=NULL,b=NULL,h=NULL,v=NULL,reg=NULL, 
+ coef=NULL,untf=FALSE,x1=NULL,x2=NULL,y1=NULL,y2=NULL,...) {
+
+ if(!is.null(c(x1,x2,y1,y2))) {
+  oldclip<-par("usr")
+  # if any clipping perimeters are not supplied, use the existing plot edges
+  if(is.null(x1)) x1<-oldclip[1]
+  if(is.null(x2)) x2<-oldclip[2]
+  if(is.null(y1)) y1<-oldclip[3]
+  if(is.null(y2)) y2<-oldclip[4]
+  clip(x1,x2,y1,y2)
+  abline(h=oldclip[4]+1)
+  clip(x1,x2,y1,y2)
+ }
+ abline(a=a,b=b,h=h,v=v,reg=reg,coef=coef,untf=untf,...)
+ if(!is.null(c(x1,x2,y1,y2))) do.call("clip",as.list(oldclip))
+}
diff --git a/R/add.ps.R b/R/add.ps.R
new file mode 100755
index 0000000..0d46b1f
--- /dev/null
+++ b/R/add.ps.R
@@ -0,0 +1 @@
+add.ps <- function(data, col.id, col.offset, col.x, col.value, fun.aggregate = "mean", ref.offset = 1, prefixes,  alternative = c("two.sided", "less", "greater"), mu = 0, paired = FALSE, var.equal = FALSE, lty = 0, ... ) {
  round.ps <- function(x) {
		as.character(ifelse(x < 0.001, "<.001", ifelse(x < 0.01, paste("=", substr(round(x, 3),2,5), sep =""),ifelse((x < 0.05) & (round(x, 2) == 0.05), "<.05", ifelse(round(x,2) == 1, ">.99", paste("=", substr(round(x, 2), 2, 4), sep = ""))))))
	}
  if(!is.data.frame(data)) stop("data must be a data.frame")
  columns <- c(col.id, col.offset, col.x, col.value)
  if (any(!(columns %in% colnames(data)))) stop("column not matching the data")
  formula.agg <- as.formula(paste(col.value, "~", col.id, "+", col.offset, "+", col.x))
  d.new <- aggregate(formula.agg, data = data, FUN = fun.aggregate)
  #so far same as in rm.plot2
  l.offset <- levels(factor(d.new[,col.offset]))
  l.offset.test <- l.offset[-ref.offset]
  if (missing(prefixes)) prefixes <- paste("p(", l.offset.test, ")", sep = "")
  l.x <- levels(factor(d.new[,col.x]))

  for (c.offset in seq_along(l.offset.test)) {
    tmp.ps <- vector("numeric", length(l.x))
    for (c.x in seq_along(l.x)) {
      tmpx <- d.new[d.new[,col.offset] == l.offset[ref.offset] & d.new[,col.x] == l.x[c.x], ]
	  tmpx <- tmpx[order(tmpx[,col.id]),]
	  tmpy <- d.new[d.new[,col.offset] == l.offset.test[c.offset] & d.new[,col.x] == l.x[c.x], ]
	  tmpy <- tmpy[order(tmpy[,col.id]),]
      tmp.ps[c.x] <- t.test(tmpx[,col.value], tmpy[,col.value], alternative = alternative, mu = mu, paired = paired, var.equal = var.equal)$p.value
    }
    tmp.labels <- paste(prefixes[c.offset], round.ps(tmp.ps), sep = "")
    axis(1,seq_along(l.x), labels = tmp.labels, line = c.offset, lty = lty,  ...)
  }      
}
\ No newline at end of file
diff --git a/R/addtable2plot.R b/R/addtable2plot.R
new file mode 100755
index 0000000..ee2c506
--- /dev/null
+++ b/R/addtable2plot.R
@@ -0,0 +1,119 @@
+addtable2plot<-function(x,y=NULL,table,lwd=par("lwd"),bty="n",
+ bg=par("bg"),cex=1,xjust=0,yjust=1,xpad=0.1,ypad=0.5,box.col=par("fg"),
+ text.col=par("fg"),display.colnames=TRUE,display.rownames=FALSE,
+ hlines=FALSE,vlines=FALSE,title=NULL) {
+
+ # make sure that there is a graphics device open
+ if(dev.cur() == 1)
+  stop("Cannot add table unless a graphics device is open")
+ # check for an xy.coords structure
+ if(is.null(y)) {
+  if(is.character(x)) {
+   tablepos<-get.tablepos(x)
+   x<-tablepos$x
+   y<-tablepos$y
+   xjust<-tablepos$xjust
+   yjust<-tablepos$yjust
+  }
+  else {
+   if(is.null(x$y)) stop("both x and y coordinates must be given")
+   y<-x$y
+   x<-x$x
+  }
+ }
+ droptop<-ifelse(any(c("topleft","top","topright") %in% x),1,0) 
+ tabdim<-dim(table)
+ if(tabdim[1] == 1) hlines<-FALSE
+ if(tabdim[2] == 1) vlines<-FALSE
+ # cat(tabdim,vlines,hlines,"\n")
+ if(is.null(dim(bg))) bg<-matrix(bg,nrow=tabdim[1],ncol=tabdim[2])
+ column.names<-colnames(table)
+ if(is.null(column.names) && display.colnames)
+  column.names<-1:tabdim[2]
+ row.names<-rownames(table)
+ if(is.null(row.names) && display.rownames)
+ row.names<-1:tabdim[1]
+ if(par("xlog")) x<-log10(x)
+ cellwidth<-rep(0,tabdim[2])
+ # assume that the column names will be at least as wide as the entries
+ if(display.colnames) {
+  for(column in 1:tabdim[2])
+   cellwidth[column]<-max(strwidth(c(column.names[column],
+    format(table[,column])),cex=cex))*(1+xpad)
+  nvcells<-tabdim[1]+1
+ }
+ else {
+  nvcells<-tabdim[1]
+  for(column in 1:tabdim[2])
+   cellwidth[column]<-max(strwidth(format(table[,column]),cex=cex))*(1+xpad)
+ }
+ if(display.rownames) {
+  nhcells<-tabdim[2]+1
+  rowname.width<-max(strwidth(row.names,cex=cex))*(1+xpad)
+ }
+ else {
+  nhcells<-tabdim[2]
+  rowname.width<-0
+ }
+ # cat(cellwidth,"\n")
+ if(par("ylog")) y<-log10(y)
+ cellheight<-
+  max(strheight(c(column.names,row.names,as.vector(unlist(table))),
+   cex=cex))*(1+ypad)
+ if(!is.null(title) & droptop) y<-y-cellheight
+ ytop<-y+yjust*nvcells*cellheight
+ # adjust for logarithmic plotting and allow the table to extend beyond the plot
+ oldpar<-par(xlog=FALSE,ylog=FALSE,xpd=TRUE)
+ if(display.colnames) {
+  xleft<-x+display.rownames*rowname.width-xjust*(sum(cellwidth)+rowname.width)
+  for(column in 1:tabdim[2]) {
+   text(xleft+cellwidth[column]*0.5,
+    ytop-0.5*cellheight,column.names[column],cex=cex,col=text.col)
+    xleft<-xleft+cellwidth[column]
+  }
+ }
+ for(row in 1:tabdim[1]) {
+  # start at the left edge of the table
+  xleft<-x-xjust*(sum(cellwidth)+rowname.width)
+  if(display.rownames) {
+   text(xleft+0.5*rowname.width,
+    ytop-(row+display.colnames-0.5)*cellheight,
+    row.names[row],cex=cex,col=text.col)
+   xleft<-xleft+rowname.width
+  }
+  for(column in 1:tabdim[2]) {
+   rect(xleft,ytop-(row+display.colnames-1)*cellheight,
+    xleft+cellwidth[column],ytop-(row+display.colnames)*cellheight,
+    col=bg[row,column],border=bg[row,column])
+   text(xleft+0.5*cellwidth[column],
+    ytop-(row+display.colnames-0.5)*cellheight,
+    table[row,column],cex=cex,col=text.col)
+    xleft<-xleft+cellwidth[column]
+  }
+ }
+ if(vlines) {
+  xleft<-x+display.rownames*rowname.width-xjust*(sum(cellwidth)+rowname.width)
+  segments(xleft+cumsum(cellwidth[-tabdim[2]]),
+   ytop-display.colnames*cellheight,
+   xleft+cumsum(cellwidth[-tabdim[2]]),
+   ytop-(display.colnames+tabdim[1])*cellheight)
+ }
+ if(hlines) {
+  xleft<-x+display.rownames*rowname.width-xjust*(sum(cellwidth)+rowname.width)
+  segments(xleft,
+   ytop-display.colnames*cellheight-cumsum(rep(cellheight,tabdim[1]-1)),
+   xleft+sum(cellwidth),
+   ytop-display.colnames*cellheight-cumsum(rep(cellheight,tabdim[1]-1)))
+ }
+ if(!is.null(title)) {
+  xleft<-x-xjust*(sum(cellwidth)+rowname.width)
+  text(xleft+(rowname.width+sum(cellwidth))/2,ytop+cellheight/2,title,
+   cex=cex,col=text.col)
+ }
+ if(bty == "o") {
+  xleft<-x+display.rownames*rowname.width-xjust*(sum(cellwidth)+rowname.width)
+  rect(xleft,ytop-(tabdim[1]+display.colnames)*cellheight,
+   xleft+sum(cellwidth),ytop-display.colnames*cellheight)
+ }
+ par(oldpar)
+}
diff --git a/R/arctext.R b/R/arctext.R
new file mode 100755
index 0000000..98f767a
--- /dev/null
+++ b/R/arctext.R
@@ -0,0 +1,41 @@
+arctext<-function(x,center=c(0,0),radius=1,start=NA,middle=pi/2,end=NA,stretch=1,
+ clockwise=TRUE,cex=NA, ...) {
+
+ oldcex <- par("cex")
+ # have to do this to get strwidth to work
+ if(is.na(cex)) cex <- oldcex
+ par(cex = cex)
+ xvec <- strsplit(x, "")[[1]]
+ lenx <- length(xvec)
+ xwidths <- stretch * strwidth(xvec)
+ charangles <- xwidths/radius
+ # make really narrow characters wider
+ changrang <- range(charangles)
+ charangles[charangles < changrang[2]/2] <- changrang[2]/2
+ if(!is.na(end)) {
+  if(clockwise) start <- end + sum(charangles)
+  else start <- end - sum(charangles)
+ }
+ if(is.na(start)) {
+  if (clockwise) start <- middle + sum(charangles)/2
+  else start <- middle - sum(charangles)/2
+ }
+ if(clockwise) {
+  charstart <- c(start, start - cumsum(charangles)[-lenx])
+  charpos <- charstart - charangles/2
+ }
+ else {
+  charstart <- c(start, start + cumsum(charangles)[-lenx])
+  charpos <- charstart + charangles/2
+ }
+ xylim <- par("usr")
+ plotdim <- par("pin")
+ ymult <- (xylim[4] - xylim[3])/(xylim[2] - xylim[1]) * plotdim[1]/plotdim[2]
+ for(xchar in 1:lenx) {
+  srt <- 180 * charpos[xchar]/pi - 90
+  text(center[1] + radius * cos(charpos[xchar]), center[2] + 
+  radius * sin(charpos[xchar]) * ymult, xvec[xchar], 
+   adj = c(0.5, 0.5), srt = srt + 180 * (!clockwise),...)
+ }
+ par(cex = oldcex)
+}
diff --git a/R/axis.break.R b/R/axis.break.R
new file mode 100755
index 0000000..b890665
--- /dev/null
+++ b/R/axis.break.R
@@ -0,0 +1,124 @@
+# axis.break places a break marker at the position "breakpos" 
+# in user coordinates on the axis nominated - see axis().
+
+axis.break<-function(axis=1,breakpos=NULL,pos=NA,bgcol="white",breakcol="black",
+ style="slash",brw=0.02) {
+ 
+ # get the coordinates of the outside of the plot
+ figxy<-par("usr")
+ # flag if either axis is logarithmic
+ xaxl<-par("xlog")
+ yaxl<-par("ylog")
+ # calculate the x and y offsets for the break
+ xw<-(figxy[2]-figxy[1])*brw
+ yw<-(figxy[4]-figxy[3])*brw
+ if(!is.na(pos)) figxy<-rep(pos,4)
+ # if no break position was given, put it just off the plot origin
+ if(is.null(breakpos))
+  breakpos<-ifelse(axis%%2,figxy[1]+xw*2,figxy[3]+yw*2)
+ if(xaxl && (axis == 1 || axis == 3)) breakpos<-log10(breakpos)
+ if(yaxl && (axis == 2 || axis == 4)) breakpos<-log10(breakpos)
+ # set up the "blank" rectangle (left, bottom, right, top)
+ switch(axis,
+  br<-c(breakpos-xw/2,figxy[3]-yw/2,breakpos+xw/2,figxy[3]+yw/2),
+  br<-c(figxy[1]-xw/2,breakpos-yw/2,figxy[1]+xw/2,breakpos+yw/2),
+  br<-c(breakpos-xw/2,figxy[4]-yw/2,breakpos+xw/2,figxy[4]+yw/2),
+  br<-c(figxy[2]-xw/2,breakpos-yw/2,figxy[2]+xw/2,breakpos+yw/2),
+  stop("Improper axis specification."))
+ # get the current setting of xpd
+ old.xpd<-par("xpd")
+ # don't cut the break off at the edge of the plot
+ par(xpd=TRUE)
+ # correct for logarithmic axes
+ if(xaxl) br[c(1,3)]<-10^br[c(1,3)]
+ if(yaxl) br[c(2,4)]<-10^br[c(2,4)]
+ if(style == "gap") {
+  if(xaxl) {
+   figxy[1]<-10^figxy[1]
+   figxy[2]<-10^figxy[2]
+  }
+  if(yaxl) {
+   figxy[3]<-10^figxy[3]
+   figxy[4]<-10^figxy[4]
+  }
+  # blank out the gap area and calculate the line segments
+  if(axis == 1 || axis == 3) {
+   rect(breakpos,figxy[3],breakpos+xw,figxy[4],col=bgcol,border=bgcol)
+   xbegin<-c(breakpos,breakpos+xw)
+   ybegin<-c(figxy[3],figxy[3])
+   xend<-c(breakpos,breakpos+xw)
+   yend<-c(figxy[4],figxy[4])
+   if(xaxl) {
+    xbegin<-10^xbegin
+    xend<-10^xend
+   }
+  }
+  else {
+   rect(figxy[1],breakpos,figxy[2],breakpos+yw,col=bgcol,border=bgcol)
+   xbegin<-c(figxy[1],figxy[1])
+   ybegin<-c(breakpos,breakpos+yw)
+   xend<-c(figxy[2],figxy[2])
+   yend<-c(breakpos,breakpos+yw)
+   if(xaxl) {
+    xbegin<-10^xbegin
+    xend<-10^xend
+   }
+  }
+  # clip the lines
+  par(xpd=TRUE)
+ }
+ else {
+  # draw the "blank" rectangle
+  rect(br[1],br[2],br[3],br[4],col=bgcol,border=bgcol)
+  if(style == "slash") {
+   # calculate the slash ends
+   if(axis == 1 || axis == 3) {
+    xbegin<-c(breakpos-xw,breakpos)
+    xend<-c(breakpos,breakpos+xw)
+    ybegin<-c(br[2],br[2])
+    yend<-c(br[4],br[4])
+    if(xaxl) {
+     xbegin<-10^xbegin
+     xend<-10^xend
+    }
+   }
+   else {
+    xbegin<-c(br[1],br[1])
+    xend<-c(br[3],br[3])
+    ybegin<-c(breakpos-yw,breakpos)
+    yend<-c(breakpos,breakpos+yw)
+    if(yaxl) {
+     ybegin<-10^ybegin
+     yend<-10^yend
+    }
+   }
+  }
+  else {
+   # calculate the zigzag ends
+   if(axis == 1 || axis == 3) {
+    xbegin<-c(breakpos-xw/2,breakpos-xw/4,breakpos+xw/4)
+    xend<-c(breakpos-xw/4,breakpos+xw/4,breakpos+xw/2)
+    ybegin<-c(ifelse(yaxl,10^figxy[3+(axis==3)],figxy[3+(axis==3)]),br[4],br[2])
+    yend<-c(br[4],br[2],ifelse(yaxl,10^figxy[3+(axis==3)],figxy[3+(axis==3)]))
+    if(xaxl) {
+     xbegin<-10^xbegin
+     xend<-10^xend
+    }
+   }
+   else {
+    xbegin<-c(ifelse(xaxl,10^figxy[1+(axis==4)],figxy[1+(axis==4)]),br[1],br[3])
+    xend<-c(br[1],br[3],ifelse(xaxl,10^figxy[1+(axis==4)],figxy[1+(axis==4)]))
+    ybegin<-c(breakpos-yw/2,breakpos-yw/4,breakpos+yw/4)
+    yend<-c(breakpos-yw/4,breakpos+yw/4,breakpos+yw/2)
+    if(yaxl) {
+     ybegin<-10^ybegin
+     yend<-10^yend
+    }
+   }
+  }
+ }
+ # draw the segments
+ segments(xbegin,ybegin,xend,yend,col=breakcol,lty=1)
+ # restore xpd
+ par(xpd=FALSE)
+}
diff --git a/R/axis.mult.R b/R/axis.mult.R
new file mode 100755
index 0000000..6a40dec
--- /dev/null
+++ b/R/axis.mult.R
@@ -0,0 +1,37 @@
+axis.mult<-function(side=1,at=NULL,labels,mult=1,mult.label="",mult.line,
+ mult.labelpos=NULL,...) {
+ if(is.null(at)) at<-axTicks(side)
+ if(missing(labels)) labels<-at/mult
+ axis(side,at,labels,...)
+ mult.label<-paste(mult.label," (* ",mult," )",sep="",collapse="")
+ # multiplier position defaults to centered on the outside
+ if(is.null(mult.labelpos)) mult.labelpos<-side
+ edges<-par("usr")
+ if(side %% 2) {
+  # either top or bottom
+  if(mult.labelpos %% 2) {
+   adj<-0.5
+   at<-(edges[1]+edges[2])/2
+   if(missing(mult.line)) mult.line<-ifelse(mult.labelpos == side,3,0)
+  }
+  else {
+   adj<-ifelse(mult.labelpos == 2,1,0) 
+   at<-ifelse(mult.labelpos == 2,edges[1],edges[2])
+   if(missing(mult.line)) mult.line<-1
+  }
+ }
+ else {
+  # either left or right
+  if(mult.labelpos %% 2) {
+   adj<-ifelse(mult.labelpos == 1,1,0) 
+   at<-ifelse(mult.labelpos == 1,edges[3],edges[4])
+   if(missing(mult.line)) mult.line<-1
+  }
+  else {
+   adj<-0.5
+   at<-(edges[3]+edges[4])/2
+   if(missing(mult.line)) mult.line=ifelse(mult.labelpos == side,3,0)
+  }
+ }
+ mtext(mult.label,side,mult.line,at=at,adj=adj,...)
+}
diff --git a/R/barNest.R b/R/barNest.R
new file mode 100755
index 0000000..f1b204d
--- /dev/null
+++ b/R/barNest.R
@@ -0,0 +1,59 @@
+barNest<-function(formula=NULL,data=NULL,FUN=c("mean","sd","sd","valid.n"),
+ ylim=NULL,main="",xlab="",ylab="",shrink=0.1,errbars=FALSE,
+ col=NA,labelcex=1,lineht=NA,showall=TRUE,Nwidths=FALSE,
+ barlabels=NULL,showlabels=TRUE,mar=NULL,arrow.cap=NA,trueval=TRUE) {
+
+ x<-brkdnNest(formula=formula,data=data,FUN=FUN,trueval=trueval)
+ getBreakListNames<-function(x) {
+  blnames<-list(names(x[[1]][[1]]))
+  for(level in 2:length(x[[1]]))
+   blnames[[level]]<-dimnames(x[[1]][[level]])[[level-1]]
+  return(blnames)
+ }
+ if(is.null(barlabels)) barlabels<-getBreakListNames(x)
+ xnames<-names(x)
+ nbn<-length(as.character(attr(terms(formula),"variables")[-1]))
+ # don't use overall value to calculate ylim when counts are displayed
+ # or when the "sum" function is used to combine pre-calculated values
+ if(FUN[1]=="valid.n" || FUN[1]=="sumbrk" || FUN[1]=="sum") {
+  if(is.null(ylim)) ylim<-c(0,1.04*max(unlist(x[[1]][[2]]),na.rm=TRUE))
+  if(FUN[1]=="valid.n" || FUN[1]=="sum") barlabels[[1]]<-""
+ }
+ intervals<-xnames[2] == xnames[3]
+ if(is.null(ylim)) {
+  if(errbars) {
+   if(intervals)
+    ylim<-c(min(unlist(x[[1]]),na.rm=TRUE)-max(unlist(x[[3]]),na.rm=TRUE),
+     max(unlist(x[[1]]),na.rm=TRUE)+max(unlist(x[[2]]),na.rm=TRUE))
+   else ylim<-
+    c(min(unlist(x[[3]]),na.rm=TRUE),max(unlist(x[[2]]),na.rm=TRUE))
+  }
+  else ylim<-range(unlist(x[[1]]),na.rm=TRUE)
+ }
+ if(is.na(arrow.cap)) arrow.cap<-0.25/length(unlist(x[[1]]))
+ ylim<-ylim+c(ifelse(ylim[1]<0,-0.04,0),0.04)*diff(ylim)
+ # don't display negative values
+ if(ylim[1] != 0) ylim[1]<-0
+ if(!is.null(mar)) oldmar<-par(mar=mar)
+ # display the blank plot
+ plot(0,xlim=c(0,1),ylim=ylim,main=main,xlab=xlab,
+  ylab=ylab,xaxt="n",yaxs="i",type="n")
+ # get the plot limits
+ parusr<-par("usr")
+ # if no line height specified for the labels, calculate it
+ if(is.na(lineht))
+  lineht<-1.05*labelcex*diff(parusr[3:4])*
+   (par("mai")[1]/par("pin")[2])/par("mar")[1]
+ # number of levels to plot
+ nlevels=length(x[[1]])
+ drawNestedBars(x,start=0,end=1,shrink=shrink,errbars=errbars,
+  intervals=intervals,col=col,labelcex=labelcex,lineht=lineht,
+  showall=showall,Nwidths=Nwidths,barlabels=barlabels,
+  showlabels=showlabels,arrow.cap=arrow.cap)
+ # is this needed?
+ abline(h=0)
+ if(FUN[1]=="valid.n") box()
+ # if the margins were changed, reset them
+ if(!is.null(mar)) par(mar=oldmar)
+ invisible(x)
+}
diff --git a/R/barlabels.R b/R/barlabels.R
new file mode 100644
index 0000000..42e91bd
--- /dev/null
+++ b/R/barlabels.R
@@ -0,0 +1,23 @@
+barlabels<-function(xpos,ypos,labels=NULL,cex=1,prop=0.5,miny=0,offset=0,...) {
+ if(is.data.frame(ypos)) ypos<-as.matrix(ypos)
+ if(is.null(labels)) labels<-ypos
+ # usually don't want to display zero labels
+ display<-ypos > miny
+ if(is.matrix(ypos)) {
+  # prop is within the scope of the current environment
+  cumcenter<-function(x,pos) return(cumsum(x)-x*prop)
+  stacked<-length(xpos) < length(ypos)
+  if(stacked) {
+   # replicate the x positions one by one, but the offsets group by group
+   xpos<-rep(xpos,each=length(ypos)/length(xpos))+
+    rep(c(-offset,offset),length(ypos)/(2*length(xpos)))
+   ypos<-apply(ypos,2,cumcenter)
+  }
+  else ypos<-ypos*prop
+ }
+ else ypos<-ypos*prop
+ # allow labels to extend beyond the plot area
+ par(xpd=TRUE)
+ boxed.labels(xpos[display],ypos[display],labels[display],cex=cex,...)
+ par(xpd=FALSE)
+}
diff --git a/R/barp.R b/R/barp.R
new file mode 100755
index 0000000..f58ab59
--- /dev/null
+++ b/R/barp.R
@@ -0,0 +1,130 @@
+barp<-function(height,width=0.4,names.arg=NULL,legend.lab=NULL,legend.pos=NULL,
+ col=NULL,border=par("fg"),main=NULL,xlab="",ylab="",xlim=NULL,ylim=NULL,x=NULL,
+ staxx=FALSE,staxy=FALSE,height.at=NULL,height.lab=NULL,cex.axis=par("cex.axis"),
+ pch=NULL,cylindrical=FALSE,shadow=FALSE,do.first=NULL,ylog=FALSE,srt=NA) {
+
+ height.class<-attr(height,"class")
+ if(!is.null(height.class)) {
+  if(match(height.class,"dstat",0)) {
+   md1<-length(height)
+   md2<-dim(height[[1]])[2]
+   meanmat<-matrix(NA,nrow=md1,ncol=md2)
+   colnames(meanmat)<-colnames(height[[1]])
+   for(row in 1:md1) meanmat[row,]<-height[[row]][1,]
+   height<-meanmat
+  }
+  if(match(height.class,"freq",0)) height<-height[[1]] 
+ }
+ if(is.data.frame(height)) its_ok<-is.numeric(unlist(height))
+ else its_ok<-is.numeric(height)
+ if(!its_ok) stop("barp can only display bars with numeric heights")
+ hdim<-dim(height)
+ if(is.null(x)) x<-1:length(height)
+ if(is.null(hdim) || length(hdim) == 1) {
+  ngroups<-length(height)
+  barcol<-col
+  barpinfo<-list(x=x,y=height)
+  hdim<-NULL
+ }
+ else {
+  ngroups<-hdim[2]
+  x<-1:ngroups
+  if(!is.matrix(col) && length(col)==hdim[1])
+   barcol<-matrix(rep(col,each=ngroups),nrow=hdim[1],byrow=TRUE)
+  else barcol<-col
+  if(!is.matrix(pch) && length(pch)==hdim[1])
+   pch<-matrix(rep(pch,ngroups),nrow=hdim[1])
+  barpinfo<-list(x=matrix(rep(1:ngroups,each=hdim[1]),ncol=hdim[2]),
+   y=as.matrix(height))
+ }
+ if(is.null(xlim)) xlim<-range(x)+c(-0.6,0.6)
+ negy<-any(height<0,na.rm=TRUE)
+ if(is.null(ylim)) {
+  if(negy) miny<-min(height,na.rm=TRUE)*1.05
+  else miny<-ifelse(ylog,min(height)/10,0)
+  ylim<-c(miny,max(height,na.rm=TRUE)*1.05)
+ }
+ else miny<-ylim[1]
+ plot(ylim[1],type="n",main=main,xlab=xlab,ylab=ylab,axes=FALSE,xlim=xlim,
+  ylim=ylim,xaxs="i",yaxs="i",log=ifelse(ylog,"y",""))
+ if(!is.null(do.first)) eval(parse(text=do.first))
+ if(negy) abline(h=0)
+ if(is.null(names.arg)) names.arg<-x
+ if(staxx) {
+  axis(1,at=x,labels=rep("",ngroups),cex.axis=cex.axis)
+  staxlab(1,at=x,labels=names.arg,cex=cex.axis,srt=srt)
+ }
+ else axis(1,at=x,labels=names.arg,cex.axis=cex.axis)
+ if(is.null(height.at)) {
+  if(ylog) height.at<-axTicks(2,log=TRUE)
+  else height.at<-pretty(ylim)
+  if(max(height.at) > max(height,na.rm=TRUE))
+   height.at<-height.at[-length(height.at)]
+ }
+ if(is.null(height.lab)) height.lab<-height.at
+ if(staxy) {
+  axis(2,at=height.at,labels=rep("",length(height.lab)),cex.axis=cex.axis)
+  staxlab(2,at=height.at,labels=height.lab,cex=cex.axis,srt=srt)
+ }
+ else axis(2,at=height.at,labels=height.lab,cex.axis=cex.axis)
+ bottoms<-ifelse(negy,0,miny)
+ if(is.null(hdim)) {
+  if(shadow) {
+   for(bar in 1:ngroups)
+    polygon.shadow(c(x[bar]-width,x[bar]-width,x[bar]+width,x[bar]+width),
+     c(bottoms,height[bar],height[bar],bottoms),
+     offset=c(0.2*width,0.05*(height[bar]-ylim[2])))
+  }
+  if(cylindrical)
+   cylindrect(x-width,bottoms,x+width,height,col=barcol,
+    border=border)
+  else {
+   if(is.null(pch))
+    rect(x-width,bottoms,x+width,height,col=barcol,border=border)
+   else
+    rectFill(x-width,bottoms,x+width,height,bg="white",fg="black",
+     pch=pch)
+  }
+ }
+ else {
+  bottoms<-matrix(bottoms,nrow=hdim[1],ncol=hdim[2])
+  barwidth<-2*width/hdim[1]
+  for(subgroup in 1:hdim[1]) {
+   barpinfo$x[subgroup,]<-1:ngroups-width+(subgroup-0.5)*barwidth
+   if(shadow) {
+    for(bar in 1:ngroups) {
+     barleft<-bar-width+(subgroup-1)*2*width/hdim[1]
+     barright<-barleft+2*width/hdim[1]
+     polygon.shadow(c(barleft,barleft,barright,barright),
+      c(bottoms[bar],height[subgroup,bar],height[subgroup,bar],bottoms[bar]),
+      offset=c(0.2*width,0.05*(height[subgroup,bar]-ylim[2])))
+    }
+   }
+   if(cylindrical)
+    cylindrect(1:ngroups-width+(subgroup-1)*barwidth,bottoms[subgroup,],
+     1:ngroups-width+(subgroup)*barwidth,height[subgroup,],
+     col=barcol[subgroup,],border=border)
+   else {
+    if(is.null(pch))
+     rect(1:ngroups-width+(subgroup-1)*barwidth,bottoms[subgroup,],
+      1:ngroups-width+(subgroup)*barwidth,height[subgroup,],
+      col=barcol[subgroup,],border=border)
+    else
+     rectFill(1:ngroups-width+(subgroup-1)*barwidth,bottoms[subgroup,],
+      1:ngroups-width+(subgroup)*barwidth,height[subgroup,],
+      bg="white",fg="black",pch=pch[subgroup,])
+   }
+  }
+ }
+ if(!is.null(legend.lab)) {
+  xjust<-yjust<-0.5
+  if(is.null(legend.pos)) {
+   cat("Click at the lower left corner of the legend\n")
+   legend.pos<-locator(1)
+   xjust<-yjust<-0
+  }
+  legend(legend.pos,legend=legend.lab,fill=col,xjust=xjust,yjust=yjust)
+ }
+ box()
+ invisible(barpinfo)
+}
diff --git a/R/battleship.plot.R b/R/battleship.plot.R
new file mode 100644
index 0000000..ee161ac
--- /dev/null
+++ b/R/battleship.plot.R
@@ -0,0 +1,32 @@
+battleship.plot<-function(x,mar=c(2,5,5,1),col="white",border="black", 
+ main="",xlab="",ylab="",xaxlab=NA,yaxlab=NA,cex.labels=1,
+ maxxspan=0.45,maxyspan=0.45) {
+
+ dimx<-dim(x)
+ if(length(dimx) != 2) 
+  stop("battleship.plot(x) where x is a 2 dimensional matrix or data frame")
+ if(is.data.frame(x)) x<-as.matrix(x)
+ oldmar<-par("mar")
+ par(mar=mar)
+ plot(0,xlim=c(0.5,dimx[2]+0.5),ylim=c(0.5,dimx[1]+0.5),axes=FALSE,
+  type="n",xlab="",ylab="")
+ title(main=main,line=mar[3]-2)
+ mtext(xlab,side=1,line=0)
+ if(is.na(xaxlab[1])) {
+  xaxlab<-colnames(x)
+  if(is.null(xaxlab)) xaxlab<-1:dimx[2]
+ }
+ staxlab(side=3,at=1:dimx[2],labels=xaxlab,srt=45,adj=0,top.line=0,
+  ticklen=0,cex=cex.labels)
+ if(is.na(yaxlab[1])) {
+  yaxlab<-rownames(x)
+  if(is.null(yaxlab)) yaxlab<-1:dimx[1]
+ }
+ staxlab(side=2,at=dimx[1]:1,labels=yaxlab,nlines=1,srt=0,adj=1,
+  top.line=0,ticklen=0,cex=cex.labels)
+ normx<-maxxspan*x/max(x,na.rm=TRUE)
+ rect(rep(1:dimx[2],each=dimx[1])-normx,rep(dimx[1]:1,dimx[2])-maxyspan,
+  rep(1:dimx[2],each=dimx[1])+normx,rep(dimx[1]:1,dimx[2])+maxyspan,
+  col=col,border=border)
+ par(mar=oldmar)
+}
diff --git a/R/box.heresy.R b/R/box.heresy.R
new file mode 100644
index 0000000..320a5d6
--- /dev/null
+++ b/R/box.heresy.R
@@ -0,0 +1,39 @@
+box.heresy<-function(x,y,uinner,linner=uinner,ulim,llim=ulim,boxwidth=NA,
+ intervals=FALSE,arrow.cap=NA,pch=22,main="",xlab="",ylab="",xaxlab=NA,
+ col="white",do.first=NULL,...) {
+
+ if(missing(y)) {
+  y<-x
+  x<-1:length(y)
+ }
+ if(is.na(xaxlab[1])) xaxlab<-x
+ if(intervals) {
+  ulim<-y+ulim
+  llim<-y-llim
+ }
+ if(is.na(boxwidth[1])) {
+  if(length(x) > 1) xrange<-range(x)
+  else xrange<-c(0.5,1.5)
+  boxwidth<-diff(xrange)/(4*length(x))
+  xspace<-diff(xrange)/10
+  xlim<-c(xrange[1]-xspace,xrange[2]+xspace)
+ }
+ else {
+  nboxes<-length(y)
+  xspace<-min(boxwidth)/4
+  x<-cumsum(boxwidth*2)+cumsum(rep(xspace,nboxes))
+  xlim<-c(xspace+boxwidth[1]/2,x[nboxes]+boxwidth[nboxes]+xspace)
+ }
+ plot(x,y,xlim=xlim,ylim=range(c(llim,ulim)),
+  main=main,xlab=xlab,ylab=ylab,type="n",xaxt="n")
+ if(!is.null(do.first)) eval(parse(text=do.first))
+ axis(1,at=x,labels=xaxlab)
+ if(is.na(arrow.cap)) arrow.cap<-boxwidth/diff(par("usr")[1:2])
+ dispersion(x,y,ulim,llim,intervals=FALSE,arrow.cap=arrow.cap,...)
+ if(intervals) {
+  uinner<-y+uinner
+  linner<-y-linner
+ }
+ rect(x-boxwidth,linner,x+boxwidth,uinner,col=col)
+ points(x,y,pch=pch)
+}
diff --git a/R/boxed.labels.R b/R/boxed.labels.R
new file mode 100755
index 0000000..a300345
--- /dev/null
+++ b/R/boxed.labels.R
@@ -0,0 +1,50 @@
+boxed.labels<-function (x, y = NA, labels,
+ bg = ifelse(match(par("bg"), "transparent", 0), "white", par("bg")),
+ border = TRUE, xpad = 1.2, ypad = 1.2, 
+ srt = 0, cex = 1, adj = 0.5, xlog=FALSE, ylog=FALSE, ...) {
+
+    oldpars <- par(c("cex", "xpd"))
+    par(cex = cex, xpd = TRUE)
+    if (is.na(y) && is.list(x)) {
+        y <- unlist(x[[2]])
+        x <- unlist(x[[1]])
+    }
+    box.adj <- adj + (xpad - 1) * cex * (0.5 - adj)
+    if (srt == 90 || srt == 270) {
+        bheights <- strwidth(labels)
+        theights <- bheights * (1 - box.adj)
+        bheights <- bheights * box.adj
+        lwidths <- rwidths <- strheight(labels) * 0.5
+    }
+    else {
+        lwidths <- strwidth(labels)
+        rwidths <- lwidths * (1 - box.adj)
+        lwidths <- lwidths * box.adj
+        bheights <- theights <- strheight(labels) * 0.5
+    }
+    args <- list(x = x, y = y, labels = labels, srt = srt, adj = adj, 
+        col = ifelse(colSums(col2rgb(bg) * c(1, 1.4, 0.6)) < 
+            350, "white", "black"))
+    args <- modifyList(args, list(...))
+    if(xlog){
+    	xpad<-xpad*2
+    	xr<-exp(log(x) - lwidths * xpad)
+    	xl<-exp(log(x) + lwidths * xpad)
+    }
+    else{
+    	xr<-x - lwidths * xpad
+    	xl<-x + lwidths * xpad
+    	}
+    if(ylog){
+    	ypad<-ypad*2
+    	yb<-exp(log(y) - bheights * ypad)
+    	yt<-exp(log(y) + theights * ypad)
+    }
+    else{
+    	yb<-y - bheights * ypad
+    	yt<-y + theights * ypad
+    	}	
+    	rect(xr, yb, xl, yt, col = bg, border = border)
+    do.call(text, args)
+    par(cex = oldpars)
+}
diff --git a/R/brkdn.plot.R b/R/brkdn.plot.R
new file mode 100755
index 0000000..da81283
--- /dev/null
+++ b/R/brkdn.plot.R
@@ -0,0 +1,142 @@
+brkdn.plot<-function(vars,groups=NA,obs=NA,data,mct="mean",md="std.error",
+ stagger=NA,dispbar=TRUE,main="Breakdown plot",xlab=NA,ylab=NA,xaxlab=NA,
+ ylim=NA,type="b",pch=1,lty=1,col=par("fg"),staxx=FALSE,yat=NA,...) {
+
+ if(class(vars) == "formula") {
+  formbits<-all.vars(vars)
+  vars<-formbits[1]
+  groups<-formbits[2]
+  obs<-formbits[3]
+ }
+ if(is.na(obs)) {
+  if(is.na(groups[1]))
+   stop("Must have at least one factor to subset data")
+  bygroup<-as.factor(data[[groups]])
+  grouplevels<-levels(bygroup)
+  ngroups<-length(grouplevels)
+  nobs<-length(vars)
+  obs.pos<-1:nobs
+  obslevels<-1:nobs
+ }
+ else {
+  if(is.numeric(data[[obs]])) {
+   obs.pos<-obslevels<-sort(unique(data[[obs]]))
+   nobs<-length(obslevels)
+  }
+  else {
+   byobs<-as.factor(data[[obs]])
+   obslevels<-levels(byobs)
+   nobs<-length(obslevels)
+   obs.pos<-1:nobs
+  }
+  if(is.na(groups)) {
+   ngroups<-length(vars)
+   grouplevels<-1:ngroups
+  }
+  else {
+   bygroup<-as.factor(data[[groups]])
+   grouplevels<-levels(bygroup)
+   ngroups<-length(grouplevels)
+   if(length(vars) > 1) {
+    warning("Group and observation factors are present, only vars[1] is plotted")
+    vars<-vars[1]
+   }
+  }
+ }
+ brkdn<-list(matrix(NA,nrow=ngroups,ncol=nobs),
+  matrix(NA,nrow=ngroups,ncol=nobs))
+ if(is.na(groups)) {
+  if(is.na(xlab)) xlab<-"Observation"
+  xat<-1:nobs
+  if(is.na(xaxlab[1])) xaxlab<-obslevels
+  for(group in 1:ngroups) {
+   for(ob in 1:nobs) {
+    thisbit<-data[[vars[group]]][data[[obs]] == obslevels[ob]]
+    if(length(thisbit)) {
+     if(length(thisbit) > 1) {
+      brkdn[[1]][group,ob]<-do.call(mct,list(thisbit,na.rm=TRUE))
+      if(!is.na(md))
+       brkdn[[2]][group,ob]<-do.call(md,list(thisbit,na.rm=TRUE))
+     }
+     else brkdn[[1]][group,ob]<-thisbit
+    }
+   }
+  }
+ }
+ else {
+  if(is.na(obs)) {
+   if(is.na(xlab)) xlab<-"Variable"
+   xat<-1:length(vars)
+   if(is.na(xaxlab[1])) xaxlab<-vars
+   for(group in 1:ngroups) {
+    for(ob in 1:nobs) {
+     thisbit<-data[[vars[ob]]][data[[groups]] == grouplevels[group]]
+     if(length(thisbit)) {
+      if(length(thisbit) > 1) {
+       brkdn[[1]][group,ob]<-do.call(mct,list(thisbit,na.rm=TRUE))
+       if(!is.na(md))
+       brkdn[[2]][group,ob]<-do.call(md,list(thisbit,na.rm=TRUE))
+      }
+      else brkdn[[1]][group,ob]<-thisbit
+     }
+    }
+   }
+  }
+  else {
+   if(is.na(xlab)) xlab<-"Observation"
+   xat<-obs.pos
+   if(is.na(xaxlab[1])) xaxlab<-obslevels
+   for(group in 1:ngroups) {
+    for(ob in 1:nobs) {
+     thisbit<-data[[vars]][data[[groups]] == grouplevels[group] &
+       data[[obs]] == obslevels[ob]]
+     if(length(thisbit)) {
+      if(length(thisbit) > 1) {
+       brkdn[[1]][group,ob]<-do.call(mct,list(thisbit,na.rm=TRUE))
+       if(!is.na(md))
+        brkdn[[2]][group,ob]<-do.call(md,list(thisbit,na.rm=TRUE))
+      }
+      else brkdn[[1]][group,ob]<-thisbit
+     }
+    }
+   }
+  }
+ }
+ if(is.na(ylim[1])) {
+  ylim<-range(brkdn[[1]],na.rm=TRUE)
+  if(!is.na(md)) {
+   dlim<-c(min(brkdn[[1]]-brkdn[[2]],na.rm=TRUE),
+     max(brkdn[[1]]+brkdn[[2]],na.rm=TRUE))
+   ylim<-c(min(c(ylim[1],dlim[1])),max(c(ylim[2],dlim[2])))
+  }
+ }
+ groupdiv<-ifelse(ngroups < 3,1,ngroups-2)
+ if(is.na(stagger)) stagger<-0.025-groupdiv*0.0025
+ if(is.na(ylab)) {
+  if(length(vars) == 1) ylab<-vars[1]
+  else ylab<-paste(vars,collapse=" and ")
+ }
+ plot(0,xlim=c(obs.pos[1]-0.5,obs.pos[nobs]+0.5),main=main,
+  xlab=xlab,ylab=ylab,ylim=ylim,type="n",axes=FALSE,...)
+ box()
+ if(staxx) staxlab(at=xat,labels=xaxlab)
+ else axis(1,at=xat,labels=xaxlab)
+ if(is.na(yat[1])) axis(2)
+ else axis(2,at=yat)
+ if(length(pch) < ngroups) pch<-rep(pch,length.out=ngroups)
+ if(length(col) < ngroups) col<-rep(col,length.out=ngroups)
+ if(length(lty) < ngroups) lty<-rep(lty,length.out=ngroups)
+ offinc<-stagger*diff(par("usr")[c(1,2)])
+ offset<-0
+ arrow.cap<-0.01-(groupdiv*0.001)
+ for(group in 1:ngroups) {
+  points(obs.pos+offset,brkdn[[1]][group,],type=type,col=col[group],
+   pch=pch[group],lty=lty[group],...)
+  if(dispbar)
+   dispersion(obs.pos+offset,brkdn[[1]][group,],brkdn[[2]][group,],
+    arrow.cap=arrow.cap,col=col[group],...)
+  offset<-ifelse(offset<0,-offset,-offset-offinc)
+ }
+ names(brkdn)<-c(mct,md)
+ return(brkdn)
+}
diff --git a/R/brkdnNest.R b/R/brkdnNest.R
new file mode 100755
index 0000000..90ed80f
--- /dev/null
+++ b/R/brkdnNest.R
@@ -0,0 +1,116 @@
+jiggle<-function(n,range=c(-1,1)) return(rescale(sample(1:n,n),range))
+
+valid.n<-function(x,na.rm=TRUE) return(ifelse(na.rm,sum(!is.na(x)),length(x)))
+
+propbrk<-function(x,trueval=TRUE,na.rm=TRUE) {
+ if(is.na(x) || length(x) == 0) return(0)
+ if(na.rm) return(sum(x==trueval,na.rm=TRUE)/valid.n(x))
+ else return(sum(x==trueval,na.rm=TRUE)/length(x))
+}
+
+sumbrk<-function(x,trueval=TRUE,na.rm=TRUE) {
+ return(sum(x==trueval,na.rm=TRUE))
+}
+
+binciW<-function(x,n,alpha=0.05,cc=FALSE) {
+ p<-x/n
+ q<-1-p
+ z<-qnorm(1-alpha/2)
+ z2<-z*z
+ if(cc) {
+  cil<-(2*n*p+z2-(z*sqrt(z2-1/n+4*n*p*q+(4*p-2))+1))/(2*(n+z2))
+  ciu<-(2*n*p+z2+(z*sqrt(z2-1/n+4*n*p*q+(4*p-2))+1))/(2*(n+z2))
+ } else {
+ cil<-(1/(1+z2/n))*(p+z2/(2*n)-z*sqrt((p/n*q)+z2/(4*n*n)))
+ ciu<-(1/(1+z2/n))*(p+z2/(2*n)+z*sqrt((p/n*q)+z2/(4*n*n)))
+ }
+ if(cil < 0) cil<-0
+ if(ciu > 1) ciu<-1
+ return(c(cil,ciu))
+}
+
+binciWu<-function(x,n,alpha=0.05,trueval=TRUE,na.rm=TRUE) {
+ if(missing(n)) n<-ifelse(na.rm,valid.n(x),length(x))
+ x<-sum(x==trueval,na.rm=TRUE)
+ return(binciW(x,n,alpha=alpha)[2])
+}
+
+binciWl<-function(x,n,alpha=0.05,trueval=TRUE,na.rm=TRUE) {
+ if(missing(n)) n<-ifelse(na.rm,valid.n(x),length(x))
+ x<-sum(x==trueval,na.rm=TRUE)
+ z<-qnorm(1-alpha/2)
+ return(binciW(x,n,alpha=alpha)[1])
+}
+
+brkdnNest<-function(formula,data,FUN=c("mean","sd","sd","valid.n"),
+ label1="Overall",trueval=TRUE) {
+
+ if(missing(data) || missing(formula)) 
+  stop("brkdnNest must be called with a formula for breakdown and a data frame.")
+ bn<-as.character(attr(terms(formula),"variables")[-1])
+ # number of variables used to break down the leftmost term
+ nbn<-length(bn)
+ # number of functions to apply at each level of breakdown
+ nFUN<-length(FUN)
+ brklist<-vector("list",nFUN)
+ truevalFUN<-c("propbrk","binciWu","binciWl","sumbrk")
+ for(brkfun in 1:nFUN) {
+  brklist[[brkfun]]<-vector("list",nbn)
+  if(FUN[brkfun] %in% truevalFUN) 
+   brklist[[brkfun]][[1]]<-do.call(FUN[brkfun],list(data[[bn[1]]], 
+    trueval=trueval,na.rm=TRUE))
+  else
+   brklist[[brkfun]][[1]]<-do.call(FUN[brkfun],list(data[[bn[1]]],
+    na.rm=TRUE))
+  names(brklist[[brkfun]][[1]])<-label1
+  for(brk in 2:nbn) {
+   if(FUN[brkfun] %in% truevalFUN) 
+    brklist[[brkfun]][[brk]]<-tapply(data[[bn[1]]],data[bn[2:brk]],
+     FUN=match.fun(FUN[brkfun]),trueval=trueval)
+   else
+    brklist[[brkfun]][[brk]]<-tapply(data[[bn[1]]], 
+     data[bn[2:brk]],FUN=match.fun(FUN[brkfun]),na.rm=TRUE)
+   names(brklist[[brkfun]][[brk]])<-levels(data[[brkfun[brk]]])
+  }
+  # get rid of the NAs in valid.n
+  if(FUN[brkfun] == "valid.n")
+   brklist[[brkfun]]<-
+    rapply(brklist[[brkfun]],function(x) ifelse(is.na(x),0,x),how="replace")
+ }
+ attr(brklist,"class")<-"brklist"
+ names(brklist)<-FUN
+ return(brklist)
+}
+
+sliceArray<-function(x,slice) {
+ dimx<-dim(x)
+ if(is.null(dimx)) return(x[slice])
+ else {
+  ndim<-length(dimx)
+  slicestring<-
+   paste("x[",slice,paste(rep(",",ndim-1),collapse=""),"]",sep="",collapse="")
+  newx<-eval(parse(text=slicestring))
+  return(newx)
+ }
+}
+
+print.brklist<-function(x,...) {
+
+ crawlBreakList<-function(x,depth=1) {
+  if(length(x)>1) {
+   if(depth==1) cat(names(x[[1]]),unlist(x[[1]]),"\n")
+   x[[1]]<-NULL
+   for(nextbit in 1:length(x[[1]])) {
+    newx<-lapply(x,sliceArray,nextbit)
+    cat(rep("\t",depth),names(x[[1]][nextbit]),unlist(x[[1]][nextbit]),"\n")
+    crawlBreakList(newx,depth=depth+1)
+   }
+  }
+ }
+
+ xnames<-names(x)
+ for(func in 1:length(x)) {
+  cat(xnames[func],"\n")
+  crawlBreakList(x[[func]])
+ }
+}
diff --git a/R/bumpchart.R b/R/bumpchart.R
new file mode 100755
index 0000000..fa65440
--- /dev/null
+++ b/R/bumpchart.R
@@ -0,0 +1,34 @@
+bumpchart<-function(y,top.labels=colnames(y),labels=rownames(y),rank=TRUE,
+ mar=c(2,8,5,8),pch=19,col=par("fg"),lty=1,lwd=1,arrows=FALSE,...) {
+
+ if(missing(y)) stop("Usage: bumpchart(y,top.labels,labels,...)")
+ ydim<-dim(y)
+ if(is.null(ydim)) stop("y must be a matrix or data frame")
+ oldmar<-par("mar")
+ par(mar=mar)
+ if(rank) y<-apply(y,2,rank)
+ # to get things the right way round, reverse the order of everything
+ labels<-rev(labels)
+ pch=rev(pch)
+ col=rev(col)
+ lty=rev(lty)
+ lwd=rev(lwd)
+ y<-apply(y,2,rev)
+ if(arrows) {
+  matplot(t(y),ylab="",type="p",pch=pch,col=col,axes=FALSE)
+  for(row in 1:(ydim[2]-1))
+   p2p_arrows(rep(row,ydim[1]),y[,row],rep(row+1,ydim[1]),y[,row+1],
+    col=col,lty=lty,lwd=lwd,...)
+ }
+ else 
+  matplot(t(y),ylab="",type="b",pch=pch,col=col,lty=lty,lwd=lwd,axes=FALSE,...)
+ par(xpd=TRUE)
+ xylim<-par("usr")
+ minspacing<-strheight("M")*1.5
+ text(1:ydim[2],xylim[4],top.labels)
+ labelpos<-spreadout(y[,1],minspacing)
+ text(xylim[1],labelpos,labels,adj=1)
+ labelpos<-spreadout(y[,ydim[2]],minspacing)
+ text(xylim[2],labelpos,labels,adj=0)
+ par(mar=oldmar,xpd=FALSE)
+}
diff --git a/R/centipede.plot.R b/R/centipede.plot.R
new file mode 100755
index 0000000..7634ad5
--- /dev/null
+++ b/R/centipede.plot.R
@@ -0,0 +1,101 @@
+# in general, get.segs expects a list with varying lengths of numeric values
+# it returns a 4xn matrix of midpoints, upper and lower limits and Ns
+# where N is the number of valid elements in the list or columns in a
+# data frame.
+
+get.segs<-function(x,mct="mean",lower.limit="std.error",
+ upper.limit=lower.limit) {
+
+ xlen<-length(x)
+ segs<-matrix(0,nrow=4,ncol=xlen)
+ for(i in 1:xlen) {
+  segs[1,i]<-do.call(mct,list(x[[i]],na.rm=TRUE))
+  segs[2,i]<-segs[1,i]-do.call(lower.limit,list(x[[i]],na.rm=TRUE))
+  segs[3,i]<-segs[1,i]+do.call(upper.limit,list(x[[i]],na.rm=TRUE))
+  segs[4,i]<-sum(!is.na(x[[i]]))
+ }
+ rownames(segs)<-c(mct,lower.limit,upper.limit,"valid.n")
+ colnames(segs)<-names(x)
+ return(segs)
+}
+
+centipede.plot<-function(segs,mct="mean",lower.limit="std.error", 
+ upper.limit=lower.limit,left.labels=NULL,right.labels=NULL,sort.segs=TRUE,
+ main="",xlab=NA,pch=21,vgrid=NA,hgrid=NA,gridcol="lightgray",mar=NA,col=par("fg"),
+ bg="green",...) {
+
+ if(missing(segs)) {
+  cat("Usage: centipede.plot(segs,...)\n\twhere segs is a dstat object")
+  stop("or a matrix of midpoints and limits")
+ }
+ if(is.list(segs)) {
+  if(all(lapply(segs,is.numeric)))
+   segs<-get.segs(segs,mct=mct,lower.limit=lower.limit,
+    upper.limit=upper.limit)
+  else stop("If segs is a list, all the components must be numeric")
+ }
+ if(class(segs) == "dstat") {
+  midpoint<-"mean"
+  if(lower.limit == "var") {
+   if(rownames(segs)[2] == "var") ll<-segs[1,]-segs[2,]
+   if(rownames(segs)[2] == "sd") ll<-segs[1,]-segs[2,]*segs[2,]
+  }
+  if(upper.limit == "var") {
+   if(rownames(segs)[2] == "var") ul<-segs[1,]+segs[2,]
+   if(rownames(segs)[2] == "sd") ul<-segs[1,]+segs[2,]*segs[2,]
+  }
+  if(lower.limit == "sd") {
+   if(rownames(segs)[2] == "var") ll<-segs[1,]-sqrt(segs[2,])
+   if(rownames(segs)[2] == "sd") ll<-segs[1,]-segs[2,]
+  }
+  if(upper.limit == "sd") {
+   if(rownames(segs)[2] == "var") ul<-segs[1,]+sqrt(segs[2,])
+   if(rownames(segs)[2] == "sd") ul<-segs[1,]+segs[2,]
+  }
+  if(lower.limit == "std.error") {
+   if(rownames(segs)[2] == "var") ll<-segs[1,]-sqrt(segs[2,])/sqrt(segs[3,])
+   if(rownames(segs)[2] == "sd") ll<-segs[1,]-segs[2,]/sqrt(segs[3,])
+  }
+  if(upper.limit == "std.error") {
+   if(rownames(segs)[2] == "var") ul<-segs[1,]+sqrt(segs[2,])/sqrt(segs[3,])
+   if(rownames(segs)[2] == "sd") ul<-segs[1,]+segs[2,]/sqrt(segs[3,])
+  }
+  segs<-rbind(segs[1,],ll,ul,segs[3,])
+ }
+ segdim<-dim(segs)
+ if (sort.segs) {
+  seg.order<-order(segs[1,])
+  segs<-segs[,seg.order]
+ }
+ else seg.order<-1:segdim[2]
+ oldpar<-par("mar")
+ if(is.na(mar[1])) mar<-c(4,6,1+2*(nchar(main)>0),5)
+ par(mar=mar)
+ plot(x=c(min(segs[2,]),max(segs[3,])),y=c(1,segdim[2]), 
+  main=main,xlab="",ylab="",type="n",axes=FALSE,...)
+ box()
+ if(!is.na(vgrid[1])) abline(v=vgrid,lty=1,col=gridcol)
+ if(is.null(hgrid)) abline(h=1:segdim[2],lty=2,col=gridcol)
+ else if(!is.na(hgrid[1])) abline(h=hgrid,lty=2,col=gridcol)
+ axis(1)
+ arrows(segs[2,],1:segdim[2],segs[3,],1:segdim[2],length=0.05, 
+  angle=90,code=3,col=col)
+ points(segs[1,],1:segdim[2],pch=pch,col=col,bg=bg)
+ if(is.null(left.labels)) {
+  left.labels<-colnames(segs)
+  if(is.null(left.labels)) left.labels<-paste("V",seg.order,sep="")
+ }
+ else left.labels<-left.labels[seg.order]
+ plot.limits<-par("usr")
+ mtext(left.labels,2,line=0.2,at=1:segdim[2],adj=1,las=1)
+ if(is.null(right.labels)) 
+  right.labels<-paste(round(segs[1,],2),"(",segs[4,],")",sep="")
+ else right.labels<-right.labels[seg.order]
+ mtext(right.labels,4,line=0.2,at=1:segdim[2],adj=0,las=1)
+ if(is.na(xlab))
+  xlab<-paste("| -",rownames(segs)[2],"-",rownames(segs)[1],"-",
+   rownames(segs)[3],"- |")
+ if (nchar(xlab)) mtext(xlab,1,line = 2)
+ par(oldpar)
+ invisible(segs)
+}
diff --git a/R/clean.args.R b/R/clean.args.R
new file mode 100755
index 0000000..2339e40
--- /dev/null
+++ b/R/clean.args.R
@@ -0,0 +1,21 @@
+clean.args<-function(argstr,fn,exclude.repeats=FALSE,exclude.other=NULL,
+ dots.ok=TRUE) {
+
+ fnargs<-names(formals(fn))
+ if(length(argstr) > 0 && !("..." %in% fnargs && dots.ok)) {
+  badargs<-names(argstr)[!sapply(names(argstr),"%in%",c(fnargs,""))]
+  for(i in badargs) argstr[[i]]<-NULL
+ }
+ if(exclude.repeats) {
+  ntab<-table(names(argstr))
+  badargs<-names(ntab)[ntab > 1 & names(ntab) != ""]
+  for (i in badargs) argstr[[i]]<-NULL
+ }
+ for(i in exclude.other) argstr[[i]]<-NULL
+ argstr
+}
+
+remove.args<-function(argstr,fn) {
+ fnargs <- names(formals(fn))
+ argstr[!(names(argstr) %in% fnargs)]
+}
diff --git a/R/clplot.R b/R/clplot.R
new file mode 100755
index 0000000..97e5d0d
--- /dev/null
+++ b/R/clplot.R
@@ -0,0 +1,138 @@
+# CLPLOT
+# Jan 2014 - Fixed a semibug in the way min/max cut levels are
+# 	generated, also cleaned up some random stuff.
+# 20 Oct.  2008 Now plots even pathological data sets without gaps
+#  Parameters:
+#	levels--	vector of desired cutpoints. Program will sort them.
+#	cols--	vector of desired color sequence (strings or numeric references)
+#	x, y--		The data, of  course.  
+#	'...' 		is intended for arguments to pass to PLOT or LINES calls
+#	lty--		plot parameter lty (see par() )
+#	showcuts--	Set to TRUE to plot gridlines at color cut levels  
+#
+clplot<-function(x,y, ylab=deparse(substitute(y)), xlab=deparse(substitute(x)),
+levels=seq(min(y)+(max(y)-min(y))/5, max(y)-(max(y)-min(y))/5, length.out=4),
+cols=c("black", "blue", "green", "orange", "red"), lty=1, showcuts=FALSE, ...) 
+{
+if(missing(y)){
+	ylab=xlab # no reason to recalc "deparse(substitute(x))"
+	y<-as.numeric(x)
+	x<-seq(1,length(y))
+# should have done this long ago: fix xlabel
+	xlab<-'index'
+	}
+xx<-as.numeric(x)
+yy<-as.numeric(y)
+levels<-sort(as.numeric(levels))
+
+#  Jan 2014:  Bugfix here: if levels has values outside min or max of data,
+# we do NOT want to creat cuts at the min,max values! And this needs to be done
+# PRIOR to checking lengths of levels vs colors; and check against cuts,
+# not against levels. 
+#### new code
+cuts<-sort(levels)
+if(min(yy)< min(levels) ) cuts<- c(min(yy),cuts)
+if(max(yy)> max(levels) ) cuts <- c(cuts, max(yy))
+#  set cols length to fit with number of cuts. (number of colors to be used)
+if (length(cuts)> length(cols)+1) {
+	cat("Warning: not enough colors. Will repeat.\n")
+	}
+#notice this will also truncate cols if it's longer than number of slices.
+cols<-rep(cols,length.out=length(cuts)-1)
+#build 'empty' graph 
+plot(xx,yy,type='n', xlab=xlab, ylab=ylab, ...)
+# initialize the list variable which will hold all modded slices
+modslice<-list()
+newxx<-xx
+newyy<-yy
+# newxx/yy will add new points as generated for each slice
+for(jj in 1 : (length(cuts)-1))	
+		{
+		botsl<-(cuts[jj]>newyy)
+		topsl<-(cuts[jj+1]<newyy)
+		botrl<-rle(botsl)
+		botlist<-cumsum(botrl$lengths[-length(botrl$lengths)])
+		toprl<-rle(topsl)
+		toplist<-cumsum(toprl$lengths[-length(toprl$lengths)])
+			# get the matching indices
+		thematch<-na.omit(match(toplist,botlist))   #finds indices of botlist I like
+			# so the *list vars have the points to use for interpolation
+		slxx<-newxx
+		slyy<-newyy
+			# if thematch is empty, avoid crashing FOR loop by using BREAK
+		for(kk in 1:length(thematch))
+			{
+			if(length(thematch)==0) break
+				# use botlist[thematch..] to get interpolation points
+				# since that's how thematch was created
+				# ny1/2 will be part of new points at cut levels
+			ny1<-cuts[jj]
+			ny2<-cuts[jj+1]
+			# stick in a couple vars for readability
+			bot1<-botlist[thematch[kk]]
+			bot2<-bot1+1
+			newx<-approx(c(newyy[bot1],newyy[bot2]),c(newxx[bot1],newxx[bot2]),ny1)
+			nx1<-newx$y
+			newx<-approx(c(newyy[bot1],newyy[bot2]),c(newxx[bot1],newxx[bot2]),ny2)
+			nx2<-newx$y
+			slxx<-c(slxx[1:(bot1+(kk-1)*2)],nx1,nx2,slxx[(bot2+(kk-1)*2):length(slxx)])
+			slyy<-c(slyy[1:(bot1+(kk-1)*2)],ny1,ny2,slyy[(bot2+(kk-1)*2):length(slyy)])
+			} #end of thematch loop
+		# Now replace newxx, newyy with slxx/yy
+		newxx<-slxx
+		newyy<-slyy			
+		} # end of FOR (jj )
+for(j in 1: (length(cuts)-1))
+	 {
+	 slice <-rep(0,length(newxx))
+#get cut of data desired -- slicelog used to build NA strings outside cutlevels
+	 slicelog<-as.logical(cuts[j]<=newyy & newyy<=cuts[j+1])
+	 is.na(slice)<-!slicelog
+	 sly<-slice+newyy
+	 slx<-newxx
+	# identify lengths of data and NAs
+	 runs<-rle(!is.na(as.logical(sly)))
+	#note: this starts thepos at the END of the first 'length' so I
+	#never bang into the x[1],y[1] data point.  
+	# Similarly, it stops at beginning of last 'length'.
+	 thepos<-0   #restart run length count 
+# generally if runs$lengths=1, means all NA, no data in slice
+	 if ( length(runs$lengths)>1 )
+			{
+			for (i in 1:(length(runs$lengths)-1)) 
+				{
+				thepos<-thepos+runs$lengths[i]
+			# "add" interp point at the end of each run
+			# whichway chooses which 'side' of interval to interpolate towards
+				whichway<-slicelog[thepos]
+			#pick correct cut value  - is subslice is going up or down
+			#whichcut chooses the cut to use
+				whichcut<-as.logical(newyy[thepos]>=cuts[j]&newyy[thepos+1]>=cuts[j])
+			#note the interpolation is TO x FROM y
+				xint3<-approx(c(newyy[thepos:(thepos+1)]),c(newxx[thepos:(thepos+1)]),cuts[j+whichcut])
+				newx <-xint3$y
+				newy <-cuts[j+whichcut]
+			# adding in "i-1" to the splitpoint to get correct location
+				slx<-c(slx[1:(thepos+(i-1))],newx,slx[(thepos+1+(i-1)):length(slx)])
+				sly<-c(sly[1:(thepos+(i-1))],newy,sly[(thepos+1+(i-1)):length(sly)])
+			}  #end of for (runs) loop; all necessary points have been added
+		} # end of if (length(runs)) 
+	  modslice<-c(modslice,list(cbind(slx,sly)))
+	  names(modslice)<-c(names(modslice)[1:(length(names(modslice))-1)],paste("newsl",j,sep=""))
+	} # end of j loop.
+
+# modslice will have one list element for each slice, empty or not
+mapply(function(x,y) suppressWarnings(lines(x[,1],x[,2], col=y, type='l', lty=lty,...)), modslice,cols)
+#suppression lets me pass '...' to both plot and lines calls, e.g. titles to plot() above
+if(showcuts==TRUE) 
+	{
+	lnx<-c(min(newxx),max(newxx))
+	lncut<-cuts[2:(length(cuts)-1)] 
+	mapply(function(rrr,sss) lines(lnx,c(rrr,sss),lty='dotted', col='black'),lncut,lncut)
+	} #end of showcuts IF
+#save interesting stuff 
+stuff<-list(xin=x,yin=y,cuts=cuts)
+stuff<-c(stuff,modslice)
+names(stuff)<-c('xin','yin','cuts',names(modslice))
+return(invisible(stuff))
+}
diff --git a/R/cluster.overplot.R b/R/cluster.overplot.R
new file mode 100755
index 0000000..650a296
--- /dev/null
+++ b/R/cluster.overplot.R
@@ -0,0 +1,34 @@
+cluster.overplot<-function(x,y,away=NULL,tol=NULL,...) {
+ if(missing(x)) stop("Usage: cluster.overplot(x,y,away=NULL,tol=NULL)")
+ dimx<-dim(x)
+ if(missing(y) && !is.null(dimx)) {
+  y<-x[,2]
+  x<-x[,1]
+ }
+ xlen<-length(x)
+ if(xlen != length(y)) stop("x and y must be the same length.")
+ if(dev.cur() == 1) plot(x,y,main="",xlab="",ylab="",axes=FALSE,type="n")
+ if(is.null(away)) away<-c(strwidth("o"),5*strheight("o")/8)
+ if(is.null(tol)) tol<-c(strwidth("o")/2,strheight("o")/2)
+ away.x<-c(0,-away[1],away[1],0,0,-away[1],away[1],-away[1],away[1])
+ away.y<-c(0,0,0,-away[2],away[2],-away[2],away[2],away[2],-away[2])
+ flags<-1:xlen
+ for(i in 1:xlen) {
+  if(!is.na(flags[i])) {
+   overplots<-abs(x-x[i]) <= tol[1] & abs(y - y[i]) <= tol[2]
+   if(sum(overplots) > 1) {
+    away.index<-1
+    for(j in 1:xlen) {
+     if(overplots[j]) {
+      x[j]<-x[j]+away.x[away.index]
+      y[j]<-y[j]+away.y[away.index]
+      away.index<-away.index+1
+      if(away.index > 9) away.index<-1
+     }
+    }
+   }
+  }
+  flags[overplots] <- NA
+ }
+ return(list(x=x,y=y,...))
+}
diff --git a/R/color.gradient.R b/R/color.gradient.R
new file mode 100755
index 0000000..dd09ae4
--- /dev/null
+++ b/R/color.gradient.R
@@ -0,0 +1,3 @@
+color.gradient<-function(reds,greens,blues,nslices=50) {
+ return(color.scale(1:nslices,reds,greens,blues))
+}
diff --git a/R/color.id.R b/R/color.id.R
new file mode 100755
index 0000000..66f36de
--- /dev/null
+++ b/R/color.id.R
@@ -0,0 +1,6 @@
+color.id<-function(col) {
+ c2 <- col2rgb(col)
+ coltab <- col2rgb(colors())
+ cdist <- apply(coltab, 2, function(z) sum((z - c2)^2))
+ colors()[which(cdist == min(cdist))]
+}
diff --git a/R/color.legend.R b/R/color.legend.R
new file mode 100755
index 0000000..7a4c46d
--- /dev/null
+++ b/R/color.legend.R
@@ -0,0 +1,36 @@
+color.legend<-function (xl,yb,xr,yt,legend,rect.col,cex=1,align="lt",
+ gradient="x",...) {
+
+ oldcex<-par("cex")
+ par(xpd=TRUE,cex=cex)
+ gradient.rect(xl,yb,xr,yt,col=rect.col,nslices=length(rect.col),
+  gradient=gradient)
+ if(gradient == "x") {
+  xsqueeze<-(xr-xl)/(2*length(rect.col))
+  textx<-seq(xl+xsqueeze,xr-xsqueeze,length.out=length(legend))
+  if(match(align,"rb",0)) {
+   texty<-yb-0.2*strheight("O")
+   textadj<-c(0.5,1)
+  }
+  else {
+   # assume it's the default
+   texty<-yt+0.2*strheight("O")
+   textadj<-c(0.5,0)
+  }
+ }
+ else {
+  ysqueeze<-(yt-yb)/(2*length(rect.col))
+  texty<-seq(yb+ysqueeze,yt-ysqueeze,length.out=length(legend))
+  if(match(align,"rb",0)) {
+   textx<-xr+0.2*strwidth("O")
+   textadj<-c(0,0.5)
+  }
+  else {
+   # assume it's the default
+   textx<-xl-0.2*strwidth("O")
+   textadj<-c(1,0.5)
+  }
+ }
+ text(textx,texty,labels=legend,adj=textadj,...)
+ par(xpd=FALSE,cex=oldcex)
+}
diff --git a/R/color.scale.R b/R/color.scale.R
new file mode 100755
index 0000000..6d9e6b2
--- /dev/null
+++ b/R/color.scale.R
@@ -0,0 +1,80 @@
+color.scale<-function(x,cs1=c(0,1),cs2=c(0,1),cs3=c(0,1),alpha=1,
+ extremes=NA,na.color=NA,xrange=NULL,color.spec="rgb") {
+ 
+ if (diff(range(x, na.rm = TRUE)) == 0) x<-x/max(x,na.rm=TRUE)
+ naxs<-is.na(x)
+ if(!is.na(extremes[1])){
+  # calculate the color ranges from the extremes - only for rgb
+  colmat<-col2rgb(extremes)
+  cs1<-colmat[1,]/255
+  cs2<-colmat[2,]/255
+  cs3<-colmat[3,]/255
+  color_spec<-"rgb"
+ }
+ maxcs1<-ifelse(color.spec=="hcl",360,1)
+ maxcs2<-ifelse(color.spec=="hcl",100,1)
+ maxcs3<-ifelse(color.spec=="hcl",100,1)
+ ncolors<-length(x)
+ if(is.null(xrange)) {
+  xrange<-range(x,na.rm=TRUE)
+  drop.extremes<-FALSE
+ }
+ else {
+  if(xrange[1] > min(x,na.rm=TRUE) || xrange[2] < max(x,na.rm=TRUE))
+   stop("An explicit range for x must include the range of x values.")
+  x<-c(xrange,x)
+  drop.extremes=TRUE
+ }
+ ncs1<-length(cs1)
+ if(ncs1>1) {
+  cs1s<-rep(cs1[ncs1],ncolors)
+  xstart<-xrange[1]
+  xinc<-diff(xrange)/(ncs1-1)
+  for(seg in 1:(ncs1-1)){
+   segindex<-which((x >= xstart) & (x <= (xstart+xinc)))
+   cs1s[segindex]<-rescale(x[segindex],cs1[c(seg,seg+1)])
+   xstart<-xstart+xinc
+  }
+  if(min(cs1s,na.rm=TRUE) < 0 || max(cs1s,na.rm=TRUE) > maxcs1)
+   cs1s<-rescale(cs1s,c(0,maxcs1))
+ }
+ else cs1s<-rep(cs1,ncolors)
+ ncs2<-length(cs2)
+ if(ncs2>1) {
+  cs2s<-rep(cs2[ncs2],ncolors)
+  xstart<-xrange[1]
+  xinc<-diff(xrange)/(ncs2-1)
+  for(seg in 1:(ncs2-1)){
+   segindex<-which((x >= xstart) & (x <= (xstart+xinc)))
+   cs2s[segindex]<-rescale(x[segindex],cs2[c(seg,seg+1)])
+   xstart<-xstart+xinc
+  }
+  if(min(cs2s,na.rm=TRUE) < 0 || max(cs2s,na.rm=TRUE) > maxcs2)
+   cs2s<-rescale(cs2s,c(0,maxcs2))
+ }
+ else cs2s<-rep(cs2,ncolors)
+ ncs3<-length(cs3)
+ if(ncs3>1) {
+  cs3s<-rep(cs3[ncs3],ncolors)
+  xstart<-xrange[1]
+  xinc<-diff(xrange)/(ncs3-1)
+  for(seg in 1:(ncs3-1)){
+   segindex<-which((x >= xstart) & (x <= (xstart+xinc)))
+   cs3s[segindex]<-rescale(x[segindex],cs3[c(seg,seg+1)])
+   xstart<-xstart+xinc
+  }
+  if(min(cs3s,na.rm=TRUE) < 0 || max(cs3s,na.rm=TRUE) > maxcs3)
+   cs3s<-rescale(cs3s,c(0,maxcs3))
+ }
+ else cs3s<-rep(cs3,ncolors)
+ if(drop.extremes) {
+  cs1s<-cs1s[-(1:2)]
+  cs2s<-cs2s[-(1:2)]
+  cs3s<-cs3s[-(1:2)]
+ }
+ xdim<-dim(x)
+ colors<-do.call(color.spec,list(cs1s,cs2s,cs3s,alpha=alpha))
+ if(!is.null(xdim)) colors<-matrix(colors,nrow=xdim[1])
+ if(length(naxs)) colors[naxs]<-na.color
+ return(colors)
+}
diff --git a/R/color.scale.lines.R b/R/color.scale.lines.R
new file mode 100755
index 0000000..e59db2f
--- /dev/null
+++ b/R/color.scale.lines.R
@@ -0,0 +1,24 @@
+color.scale.lines<-function(x,y,reds,greens,blues,col=NA,colvar=NA,...) {
+
+ if(is.list(x) && missing(y)) {
+  y<-x$y
+  x<-x$x
+ }
+ lenx<-length(x)
+ leny<-length(y)
+ nseg<-lenx-1
+ if(lenx != leny) {
+  warning("x and y are different lengths - some values will be ignored")
+  if(lenx>leny) nseg<-leny-1
+ }
+ if(is.na(col[1])) {
+  # if colors are not supplied
+  if(is.na(colvar[1]))
+   # if a separate variable is not supplied, use running average of y pairs
+   lcol<-color.scale((y[1:nseg]+y[2:(nseg+1)])/2,reds,greens,blues)
+  # assume that colvar refers to the intervals, not the x/y points
+  else lcol<-color.scale(colvar,reds,greens,blues)
+ }
+ else lcol=col
+ segments(x[1:nseg],y[1:nseg],x[2:(nseg+1)],y[2:(nseg+1)],col=lcol,...)
+}
diff --git a/R/color2D.matplot.R b/R/color2D.matplot.R
new file mode 100755
index 0000000..89214e5
--- /dev/null
+++ b/R/color2D.matplot.R
@@ -0,0 +1,133 @@
+hexagon<-function(x,y,unitcell=1,col=NA,border="black") {
+ polygon(c(x,x,x+unitcell/2,x+unitcell,x+unitcell,x+unitcell/2),
+  c(y+unitcell*0.125,y+unitcell*0.875,y+unitcell*1.125,y+unitcell*0.875,
+    y+unitcell*0.125,y-unitcell*0.125),col=col,border=border)
+}
+
+fill.corner<-function(x,nrow,ncol,na.value=NA) {
+ xlen<-length(x)
+ ncells<-ifelse(nrow*ncol < xlen,nrow*ncol,xlen)
+ newmat<-matrix(na.value,nrow=nrow,ncol=ncol)
+ xside<-1
+ while(xside*xside < ncells) xside<-xside+1
+ row=1
+ col=1
+ for(xindex in 1:ncells) {
+  newmat[row,col]<-x[xindex]
+  if(row == xside) {
+   col<-col+1
+   row<-1
+  }
+  else row<-row+1
+ }
+ return(newmat)
+}
+
+color2D.matplot<-function(x,cs1=c(0,1),cs2=c(0,1),cs3=c(0,1),
+ extremes=NA,cellcolors=NA,show.legend=FALSE,nslices=10,xlab="Column",
+ ylab="Row",do.hex=FALSE,axes=TRUE,show.values=FALSE,vcol=NA,vcex=1,
+ border="black",na.color=NA,xrange=NULL,color.spec="rgb",yrev=TRUE,
+ xat=NULL,yat=NULL,Hinton=FALSE,...) {
+ 
+ if(diff(range(x,na.rm=TRUE)) == 0) x<-x/max(x,na.rm=TRUE)
+ if(is.matrix(x) || is.data.frame(x)) {
+  xdim<-dim(x)
+  if(is.data.frame(x)) x<-unlist(x)
+  else x<-as.vector(x)
+  oldpar<-par("xaxs","yaxs","xpd","mar")
+  par(xaxs="i",yaxs="i")
+  if(do.hex) par(mar=c(5,4,4,4))
+  plot(c(0,xdim[2]),c(0,xdim[1]),xlab=xlab,ylab=ylab,type="n",axes=FALSE,...)
+  oldpar$usr<-par("usr")
+  if(!do.hex) {
+   box()
+   pos<-0
+  }
+  else pos<- -0.3
+  if(axes) {
+   if(is.null(xat)) xat<-pretty(0:xdim[2])[-1]
+   axis(1,at=xat-0.5,labels=xat,pos=pos)
+   if(is.null(yat)) yat<-pretty(0:xdim[1])[-1]
+   axis(2,at=xdim[1]-yat+0.5,labels=yat)
+  }
+  if(all(is.na(cellcolors))) {
+   if(Hinton) {
+    if(is.na(extremes[1])) extremes<-c("black","white")
+    cellcolors<-extremes[(x > 0) + 1]
+   }
+   else cellcolors<-color.scale(x,cs1,cs2,cs3,extremes=extremes,
+    na.color=na.color,color.spec=color.spec)
+  }
+  # this sets the color for overprinted text to black or white
+  # depending upon what color will be the background for the text
+  if(is.na(vcol))
+   vcol<-ifelse(colSums(col2rgb(cellcolors)*c(1,1.4,0.6))<350,"white","black")
+  # if it's a Hinton diagram,cellsize = x, rescaling to 0,1 if necessary
+  if(Hinton) {
+   if(any(x < 0 | x > 1)) cellsize<-matrix(rescale(abs(x),c(0,1)),nrow=xdim[1])
+  }
+  else cellsize<-matrix(1,nrow=xdim[1],ncol=xdim[2])
+  # start from the top left - isomorphic with the matrix layout
+  if(do.hex) {
+   par(xpd=TRUE)
+   offset<-0
+   if(length(border) < xdim[1]*xdim[2])
+    border<-rep(border,length.out=xdim[1]*xdim[2])
+   for(row in 1:xdim[1]) {
+    for(column in 0:(xdim[2]-1)) {
+     hexagon(column+offset,xdim[1]-row,unitcell=cellsize[row,column+1],
+      col=cellcolors[row+xdim[1]*column],
+      border=border[row+xdim[1]*column])
+     if(show.values)
+      text(column+offset+0.5,xdim[1]-row+0.5,x[row+column*xdim[1]],
+       col=vcol[row+xdim[1]*column],cex=vcex)
+    }
+    offset<-ifelse(offset,0,0.5)
+   }
+   par(xpd=FALSE)
+  }
+  else {
+   if(Hinton) inset<-(1-cellsize)/2
+   else inset<-0
+   if(yrev) {
+    y0<-rep(seq(xdim[1]-1,0,by=-1),xdim[2])+inset
+    y1<-rep(seq(xdim[1],1,by=-1),xdim[2])-inset
+   }
+   else {
+    y0<-rep(0:(xdim[1]-1),xdim[2])+inset
+    y1<-rep(1:xdim[1],xdim[2])-inset
+   }
+   rect(sort(rep((1:xdim[2])-1,xdim[1]))+inset,y0,
+    sort(rep(1:xdim[2],xdim[1]))-inset,y1,
+    col=cellcolors,border=border)
+   if(show.values) {
+    if(yrev) texty<-rep(seq(xdim[1]-0.5,0,by=-1),xdim[2])
+    else texty<-rep(seq(0.5,xdim[1]-0.5,by=1),xdim[2])
+    text(sort(rep((1:xdim[2])-0.5,xdim[1])),texty,
+     round(x,show.values),col=vcol,cex=vcex)
+   }
+  }
+  naxs<-which(is.na(x))
+  xy<-par("usr")
+  plot.din<-par("din")
+  plot.pin<-par("pin")
+  bottom.gap<-(xy[3]-xy[4])*(plot.din[2]-plot.pin[2])/(2*plot.pin[2])
+  grx1<-xy[1]
+  gry1<-bottom.gap*0.95
+  grx2<-xy[1]+(xy[2]-xy[1])/4
+  gry2<-bottom.gap*0.8
+  if(length(cellcolors) > 1) {
+   colmat<-col2rgb(c(cellcolors[which.min(x)],cellcolors[which.max(x)]))
+   cs1<-colmat[1,]/255
+   cs2<-colmat[2,]/255
+   cs3<-colmat[3,]/255
+   color.spec<-"rgb"
+  }
+  rect.col<-color.scale(1:nslices,cs1,cs2,cs3,color.spec=color.spec)
+  if(show.legend)
+   color.legend(grx1,gry1,grx2,gry2,round(range(x,na.rm=TRUE),show.legend),
+    rect.col=rect.col)
+  par(oldpar)
+ }
+ else cat("x must be a data frame or matrix\n")
+}
diff --git a/R/corner.label.R b/R/corner.label.R
new file mode 100755
index 0000000..54d9d64
--- /dev/null
+++ b/R/corner.label.R
@@ -0,0 +1,24 @@
+corner.label<-function(label=NULL,x=-1,y=1,xoff=NA,yoff=NA,figcorner=FALSE,...) {
+
+ if(is.na(xoff)) xoff<-strwidth("m")/2
+ if(is.na(yoff)) yoff<-strheight("m")/2
+ par.usr<-par("usr")
+ xpos<-par.usr[(3+x)/2]
+ ypos<-par.usr[(3+y)/2+2]
+ if(figcorner) {
+  par.pin<-par("pin")
+  xplotrange<-par.usr[2]-par.usr[1]
+  yplotrange<-par.usr[4]-par.usr[3]
+  par.mai<-par("mai")
+  xmar<-xplotrange*par.mai[3+x]/par.pin[1]
+  ymar<-yplotrange*par.mai[2+y]/par.pin[2]
+  xpos<-xpos+x*xmar
+  ypos<-ypos+y*ymar
+ }
+ if(!is.null(label)) {
+  if(figcorner) par(xpd=TRUE)
+  text(xpos-x*xoff,ypos-y*yoff,label,adj=c((1+x)/2,(1+y)/2))
+  if(figcorner) par(xpd=FALSE)
+ }
+ return(list(x=xpos,y=ypos))
+}
diff --git a/R/count.overplot.R b/R/count.overplot.R
new file mode 100755
index 0000000..6d0eb18
--- /dev/null
+++ b/R/count.overplot.R
@@ -0,0 +1,60 @@
+count.overplot<-function(x,y,tol=NULL,col=par("fg"),pch="1",...) {
+ if(missing(x)) stop("Usage: count.overplot(x,y,tol=NULL,...)")
+ dimx<-dim(x)
+ if(missing(y)) {
+  if(is.list(x) && names(x)[1] == "x") {
+   y<-x[[2]]
+   x<-x[[1]]
+  }
+  else {
+   if(!is.null(dimx)) {
+    y<-x[,2]
+    x<-x[,1]
+   }
+  }
+ }
+ if(any(is.na(x) | is.na(y))) {
+  indices<-!is.na(x) & !is.na(y)
+  x<-x[indices]
+  y<-y[indices]
+ }
+ xlim<-range(x)
+ ylim<-range(y)
+ xlen<-length(x)
+ if(xlen != length(y)) stop("x and y must be the same length.")
+ if(is.null(tol)) {
+  if(dev.cur() == 1 ) plot(x,y,type="n",axes=FALSE,xlab="",ylab="")
+  tol<-c(strwidth("o")/2,strheight("o")/2)
+ }
+ else {
+  if (length(tol) == 1) tol <- rep(tol,2)
+ }
+ if(length(col) < xlen) col<-rep(col,xlen)
+ if(length(pch) < xlen) pch<-rep(pch,xlen)
+ flags<-1:xlen
+ xsep<-ysep<-xdup<-ydup<-xydup<-sepcol<-seppch<-rep(0,xlen)
+ nsep<-ndup<-0
+ for(i in 1:xlen) {
+  if(!is.na(flags[i])) {
+   dups<-abs(x - x[i]) <= tol[1] & abs(y - y[i]) <= tol[2]
+   ndups<-sum(dups)
+   if(ndups > 1) {
+    ndup<-ndup + 1
+    xydup[ndup]<-ndups
+    xdup[ndup]<-x[i]
+    ydup[ndup]<-y[i]
+   }
+   else {
+    nsep<-nsep + 1
+    xsep[nsep]<-x[i]
+    ysep[nsep]<-y[i]
+    sepcol[nsep]<-col[i]
+    seppch[nsep]<-pch[i]
+   }
+  }
+  flags[dups]<-NA
+ }
+ plot(xsep[1:nsep],ysep[1:nsep],xlim=xlim,ylim=ylim,
+  col=sepcol[1:nsep],pch=seppch[1:nsep],...)
+ text(xdup[1:ndup],ydup[1:ndup],xydup[1:ndup],...)
+}
diff --git a/R/cylindrect.R b/R/cylindrect.R
new file mode 100755
index 0000000..f7063cd
--- /dev/null
+++ b/R/cylindrect.R
@@ -0,0 +1,16 @@
+cylindrect<-function(xleft,ybottom,xright,ytop,col,border=NA,gradient="x",
+ nslices=50) {
+ 
+ rgbval<-col2rgb(col)/255
+ maxrgb<-max(rgbval)
+ cols<-matrix(0,nrow=3,ncol=6)
+ for(i in 1:3) {
+  if(rgbval[i] == maxrgb) delta<-1-rgbval[i]
+  else delta<-(1-0.2*(maxrgb-rgbval[i])/sum(maxrgb-rgbval))-rgbval[i]
+  cols[i,]<-c(rgbval[i]+0.3*delta,rgbval[i]+0.6*delta,rgbval[i]+0.9*delta,
+   rgbval[i]+0.6*delta,rgbval[i]+0.3*delta,rgbval[i])
+ }
+ gradient.rect(xleft,ybottom,xright,ytop,cols[1,],cols[2,],cols[3,],
+  gradient=gradient,nslices=nslices,border=border)
+ invisible(cols)
+}
diff --git a/R/dendrite.R b/R/dendrite.R
new file mode 100755
index 0000000..b725f25
--- /dev/null
+++ b/R/dendrite.R
@@ -0,0 +1,100 @@
+makeDendrite<-function(x) {
+ dimx<-dim(x)
+ if (is.null(dimx)) {
+  dend.tab<-table(as.character(x),useNA="ifany")
+  tablen<-length(dend.tab)
+  dendrite<-vector("list",tablen)
+  for(i in 1:tablen) dendrite[[i]]<-list(dend.tab[i],NULL)
+ }
+ else {
+  dend.tab<- table(as.character(x[, 1]),useNA="ifany")
+  tablen<-length(dend.tab)
+  tabname<-names(dend.tab)
+  dendrite<-vector("list",tablen)
+  for(i in 1:tablen) {
+   if(is.na(tabname[i]))
+    nextx<-x[is.na(x[,1]),2:dimx[2]]
+   else
+    nextx<-x[as.character(x[,1])==tabname[i]&!is.na(x[,1]),2:dimx[2]]
+   dendrite[[i]] <- list(dend.tab[i], makeDendrite(nextx))
+  }
+ }
+ class(dendrite) <- "dendrite"
+ return(dendrite)
+}
+
+sumDendrite<-function(x) {
+ dsum<-0
+ for(i in 1:length(x)) dsum<-dsum+x[[i]][[1]]
+ return(dsum)
+}
+
+furc<-function (x, xpos, yrange, toplevel, maxx, cex = 1, col) 
+{
+    xlen <- length(x)
+    if (xlen) {
+        yinc <- diff(yrange)/xlen
+        ypos <- seq(yrange[1] + yinc/2, yrange[2] - yinc/2, length.out = xlen)
+        if (xpos > maxx) 
+            xoffset <- rep(c(-0.17, 0.17), length.out = xlen)
+        else xoffset <- rep(0, xlen)
+        if (!toplevel) {
+            if (xlen > 1) 
+                segments(xpos - 0.5, ypos[1], xpos - 0.5, ypos[xlen])
+            segments(xpos - 0.5, ypos, xpos + xoffset, ypos)
+        }
+        for (i in 1:xlen) {
+            if (is.list(x[[i]][[2]])) {
+                segments(xpos, ypos[i], xpos + 0.5, ypos[i])
+                furc(x[[i]][[2]], xpos + 1, c(ypos[i] - yinc/2, 
+                  ypos[i] + yinc/2), FALSE, maxx, cex = cex, 
+                  col = col)
+            }
+            xname <- names(x[[i]][[1]])
+            if (is.na(xname)) 
+                xname <- "NA"
+            boxed.labels(xpos + xoffset[i], ypos[i], paste(xname, 
+                x[[i]][[1]]), cex = cex, bg = col[which(names(col) == 
+                xname)])
+        }
+    }
+}
+
+listDepth<-function(x) {
+ if(is.list(x)) {
+  maxdepth<-1
+  for(lindex in 1:length(x)) {
+   newdepth<-listDepth(x[[lindex]])+1
+   if(newdepth > maxdepth) maxdepth<-newdepth
+  }
+ }
+ else maxdepth<-0
+ return(maxdepth)
+}
+
+plot.dendrite<-function (x, xlabels = NULL, main = "", mar = c(1, 0, 3, 0), 
+    cex = 1, col = "white", ...) 
+{
+    if (class(x) != "dendrite") 
+        x <- makeDendrite(x)
+    xnames <- unique(names(unlist(x)))
+    xnames[is.na(xnames)] <- "NA"
+    xnames <- sort(xnames)
+    if (length(col) < length(xnames)) {
+        col <- rep(col, length.out = length(xnames))
+        names(col) <- as.character(xnames)
+    }
+    oldmar <- par("mar")
+    par(mar = mar)
+    xmax <- listDepth(x)/2
+    ymax <- sumDendrite(x)
+    plot(0, main = main, xlim = c(0.25, xmax), ylim = c(1, ymax), 
+        xlab = "", ylab = "", type = "n", axes = FALSE, ...)
+    par(xpd = TRUE)
+    text(seq(0.5, xmax), par("usr")[3], xlabels)
+    par(xpd = FALSE)
+    furc(x, 0.5, c(1, ymax), TRUE, maxx = xmax - 1, cex = cex, 
+        col = col)
+    par(mar = oldmar)
+}
+
diff --git a/R/dendroPlot.R b/R/dendroPlot.R
new file mode 100644
index 0000000..66a70c8
--- /dev/null
+++ b/R/dendroPlot.R
@@ -0,0 +1,49 @@
+dendroPlot<-function(x,breaks=list(10,10,10),pch=1,col=par("fg"),cex=1,nudge=NA,
+ setlabels=NA,...) {
+
+ plot(c(0.5,length(x)+0.5),range(unlist(sapply(x,as.numeric))),
+  type="n",xaxt="n",...)
+ lenx<-length(x)
+ if(is.na(setlabels[1])) setlabels<-paste("Group",1:lenx)
+ axis(1,at=1:lenx,labels=setlabels)
+ if(is.na(nudge[1])) nudge<-strwidth("o")
+ if(length(pch) < lenx) pch<-rep(pch,length.out=lenx)
+ if(length(col) < lenx) col<-rep(col,length.out=lenx)
+ for(list_element in 1:length(x)) {
+  if(is.character(x[[list_element]]))
+   x[[list_element]]<-factor(x[[list_element]])
+  if(is.factor(x[[list_element]])) nbins<-length(levels(x[[list_element]]))
+  else {
+   xbreaks<-cut(x[[list_element]],breaks=breaks[[list_element]])
+   nbins<-length(levels(xbreaks))
+  }
+  for(bin in 1:nbins) {
+   if(is.factor(x[[list_element]])) {
+    thisbin<-which(as.numeric(x[[list_element]])==bin)
+    npoints<-length(thisbin)
+   }
+   else {
+    thisbin<-which(as.numeric(xbreaks)==bin)
+    npoints<-length(thisbin)
+   }
+   if(npoints) {
+    if(npoints==1) offsetx<-offsety<-0
+    else {
+     offsetx<-(c(0,trunc(seq(1,npoints/2,by=0.5)))*nudge[1])[1:npoints]
+     # only apply the vertical nudge for factors
+     if(length(nudge) > 1 && is.factor(x[[list_element]]))
+      offsety<-c(0,rep(c(nudge[2],nudge[2],-nudge[2],-nudge[2]),
+       length.out=npoints-1))
+     else offsety<-rep(0,length(offsetx))
+    }
+    if(length(offsetx) > 3 )
+     offsetx[seq(2,length(offsetx),by=2)]<-
+      -offsetx[seq(2,length(offsetx),by=2)]
+    else if(length(offsetx) == 3 ) offsetx[2]<--offsetx[2]
+    points(list_element+offsetx,
+     sort(as.numeric(x[[list_element]][thisbin]))+offsety,
+     pch=pch[list_element],col=col[list_element])
+   }
+  }
+ }
+}
diff --git a/R/diamondplot.R b/R/diamondplot.R
new file mode 100755
index 0000000..9654bee
--- /dev/null
+++ b/R/diamondplot.R
@@ -0,0 +1,85 @@
+diamondplot<-function(x, bg=gray(0.6), col=rainbow,name="", ...) {
+
+  if(!is.data.frame(x)) stop("Argument has to be a data frame")
+
+  ## read original graphical parms
+  opar<-par(no.readonly = TRUE)
+
+  ## set background
+  par(bg=bg)
+
+  prop<-0.8
+  scale<-5
+
+  ## define aux. functions
+
+  ## degrees to radiants
+  deg2rad<-function(alfa) {
+  (alfa*pi)/180
+  }
+
+  ## normalize data w.r.t. maximum
+  normalizza<-function(x){
+  x/max(x)
+  }
+
+  ## find points' coordinates
+  coord<-function(x, prop=17) {
+  n<-length(x)
+  alfa<-rep(NA,n)
+   for (i in 1:n) {
+    alfa[i]<-360/n*i
+    }
+  c.x<-sin(deg2rad(alfa))*x*prop
+  c.y<-cos(deg2rad(alfa))*x*prop
+  list(x=c.x,y=c.y)
+  }
+
+  ## plot n segments originating from the origin(!)
+  segmenti<-function(n, prop=1, labels=NULL,scale=5) {
+  plot(0,0,axes=FALSE,xlab="",ylab="",main=name,...)
+  for(i in 1:n) {
+    alfa<-360/n*i
+    x1<-c(0,sin(deg2rad(alfa))*prop)
+    y1<-c(0,cos(deg2rad(alfa))*prop)
+    polygon(x1,y1)
+    text(sin(deg2rad(alfa)),cos(deg2rad(alfa)),labels[i],cex=0.8)
+    }
+    for (i in 1:n) {
+     alfa<-360/n*i
+       for( j in 1:scale) {
+       xa<-(sin(deg2rad(alfa))*(1/scale)*j*prop)
+       ya<-(cos(deg2rad(alfa))*(1/scale)*j*prop)
+
+       points(xa,ya,pch=19)
+       et<-round((1/scale)*j*17)
+       text(sin(deg2rad(0))+0.1,cos(deg2rad(0))*(1/scale)*j*prop,et,cex=0.8)
+       }
+
+    }
+  }
+
+  n<-dim(x)[[1]]
+
+  k<-dim(x)[[2]]
+
+  segmenti(n, prop=prop, labels=rownames(x))
+
+  for (j in 1:k) {
+    polygon(coord(normalizza(x[,j]), prop=prop), lty=j, border=col(k)[j])
+    }
+
+  legend(-1.05,1.05,legend=dimnames(x)[[2]],lty=1:k,col=col(k),cex=0.8)
+
+ ## ripristinate original graph parms
+  par(opar)
+}
+
+
+
+
+
+
+
+
+
diff --git a/R/dispersion.R b/R/dispersion.R
new file mode 100755
index 0000000..a63b0ef
--- /dev/null
+++ b/R/dispersion.R
@@ -0,0 +1,99 @@
+dispersion<-function (x, y, ulim, llim = ulim, intervals = TRUE, arrow.cap = 0.01, 
+    arrow.gap = NA, type = "a", fill = NA, lty = NA, pch = NA, 
+    border = NA, col = par("fg"), display.na = TRUE, ...) 
+{
+    if (is.list(x) && length(x[[1]]) == length(x[[2]])) {
+        y <- x$y
+        x <- x$x
+    }
+    if (missing(y) && !missing(x)) {
+        y <- x
+        x <- 1:length(x)
+    }
+    if (intervals) {
+        llim <- y - llim
+        ulim <- y + ulim
+    }
+    plotlim <- par("usr")
+    npoints <- length(x)
+    if (is.na(arrow.gap)) 
+        arrow.gap <- strheight("O")/1.5
+    if (length(col) < npoints) {
+        if (is.matrix(x) && length(col) == dim(x)[2]) 
+            col <- rep(col, each = dim(x)[1])
+        else col <- rep(col, npoints)
+    }
+    for (i in 1:npoints) {
+        if (toupper(type) == "A") {
+            if (!is.na(llim[i])) {
+                if (arrow.gap >= (y[i] - llim[i]) * 0.9) {
+                  caplen <- arrow.cap * diff(par("usr")[1:2])
+                  x0 <- x[i] - caplen
+                  x1 <- x[i] + caplen
+                  y0 <- y1 <- llim[i]
+                  segments(x0, y0, x1, y1, col = col[i], ...)
+                }
+                else {
+                  caplen <- arrow.cap * par("pin")[1]
+                  x0 <- x1 <- x[i]
+                  y0 <- y[i] - arrow.gap
+                  y1 <- llim[i]
+                  arrows(x0, y0, x1, y1, length = caplen, angle = 90, 
+                    col = col[i], ...)
+                }
+            }
+            else {
+                if (display.na) {
+                  x0 <- x1 <- x[i]
+                  y0 <- y[i] - arrow.gap
+                  y1 <- plotlim[3]
+                  segments(x0, y0, x1, y1, col = col[i], ...)
+                }
+            }
+            if (!is.na(ulim[i])) {
+                if (arrow.gap >= (ulim[i] - y[i]) * 0.9) {
+                  caplen <- arrow.cap * diff(par("usr")[1:2])
+                  x0 <- x[i] - caplen
+                  x1 <- x[i] + caplen
+                  y0 <- y1 <- ulim[i]
+                  segments(x0, y0, x1, y1, col = col[i], ...)
+                }
+                else {
+                  caplen <- arrow.cap * par("pin")[1]
+                  x0 <- x1 <- x[i]
+                  y0 <- y[i] + arrow.gap
+                  y1 <- ulim[i]
+                  arrows(x0, y0, x1, y1, length = caplen, angle = 90, 
+                    col = col[i], ...)
+                }
+            }
+            else {
+                if (display.na) {
+                  x0 <- x1 <- x[i]
+                  y0 <- y[i] + arrow.gap
+                  y1 <- plotlim[4]
+                  segments(x0, y0, x1, y1, col = col[i], ...)
+                }
+            }
+        }
+    }
+    if (toupper(type) == "L") {
+        if (!is.na(fill)) {
+            polygon(c(x, rev(x)), c(ulim, rev(llim)), col = fill, 
+                border = NA)
+            if (!is.na(pch)) {
+                if (is.na(lty)) 
+                  points(x, y, pch = pch)
+                else lines(x, y, lty = lty, pch = pch, type = "b")
+            }
+            else {
+                if (!is.na(lty)) 
+                  lines(x, y, lty = lty)
+            }
+        }
+        if (!is.na(border)) {
+            lines(x, ulim, lty = border, ...)
+            lines(x, llim, lty = border, ...)
+        }
+    }
+}
diff --git a/R/display.overplot.R b/R/display.overplot.R
new file mode 100644
index 0000000..33fe46a
--- /dev/null
+++ b/R/display.overplot.R
@@ -0,0 +1,76 @@
+find_overplots<-function(x,y,tol) {
+ xlen<-length(x)
+ flags<-1:xlen
+ xsep<-ysep<-xdup<-ydup<-xydup<-rep(NA,xlen)
+ nsep<-ndup<-0
+ for(i in 1:xlen) {
+  if(!is.na(flags[i])) {
+   dups<-abs(x - x[i]) <= tol[1] & abs(y - y[i]) <= tol[2]
+   ndups<-sum(dups,na.rm=TRUE)
+   if(ndups > 1) {
+    ndup<-ndup + 1
+    xydup[ndup]<-ndups
+    xdup[ndup]<-x[i]
+    ydup[ndup]<-y[i]
+   }
+   else {
+    nsep<-nsep + 1
+    xsep[nsep]<-x[i]
+    ysep[nsep]<-y[i]
+   }
+  }
+  flags[dups]<-NA
+ }
+ return(list(xsep=xsep,ysep=ysep,xdup=xdup,ydup=ydup,xydup=xydup))
+}
+
+display.overplots<-function(x,y,tol=NULL,how=c("count","cluster","size"),
+ xlim=NULL,ylim=NULL,col=rep(par("fg"),2),pch=c("1",1),spc=NULL,...) {
+
+ if(missing(x)) stop("display.overplots must have xy coordinates")
+ dimx<-dim(x)
+ if(missing(y)) {
+  if(is.list(x) && names(x)[1] == "x") {
+   y<-x[[2]]
+   x<-x[[1]]
+  }
+  else {
+   if(!is.null(dimx)) {
+    y<-x[,2]
+    x<-x[,1]
+   }
+  }
+ }
+ if(any(is.na(x) | is.na(y))) {
+  indices<-!is.na(x) & !is.na(y)
+  x<-x[indices]
+  y<-y[indices]
+ }
+ if(is.null(xlim)) xlim<-range(x)
+ if(is.null(ylim)) ylim<-range(y)
+ xlen<-length(x)
+ if(xlen != length(y)) stop("x and y must be the same length.")
+ plot(x,y,type="n",axes=FALSE,xlab="",ylab="")
+ xylim<-par("usr")
+ if(is.null(tol)) tol<-c(diff(xylim[1:2]/100),diff(xylim[3:4]/100))
+ else if(length(tol) == 1) tol <- rep(tol,2)
+ if(length(col) < xlen) col<-rep(col,xlen)
+ if(length(pch) < xlen) pch<-rep(pch,xlen)
+ if(is.null(spc)) spc<-c(diff(xylim[1:2])/100,diff(xylim[3:4]/100))
+ xy<-find_overplots(x,y,tol)
+ plot(xy$xsep,xy$ysep,xlim=xlim,ylim=ylim,col=col[1],pch=pch[1],...)
+ if(how[1] == "count") text(xy$xdup,xy$ydup,xy$xydup,col=col[2],...)
+ if(how[1] == "cluster") {
+  xshifts<-c(0,-spc[1],spc[1],0,0,-spc[1],spc[1],-spc[1],spc[1])
+  yshifts<-c(0,0,0,-spc[2],spc[2],-spc[2],spc[2],spc[2],-spc[2])
+  for(dup in 1:sum(!is.na(xy$xdup))) {
+   for(ndups in 1:min(c(xy$xydup[dup],9))) {
+    points(xy$xdup[dup]+xshifts[ndups],xy$ydup[dup]+yshifts[ndups],
+     pch=pch[2],col=col[2],...)
+   }
+   if(xy$xydup[dup] > 9) points(xy$xdup[dup],xy$ydup[dup],pch=4,cex=2)
+  }
+ }
+ if(how[1] == "size")
+  points(xy$xdup,xy$ydup,pch=pch[2],col=col[2],cex=sqrt(xy$xydup))
+}
diff --git a/R/dotplot.mtb.R b/R/dotplot.mtb.R
new file mode 100755
index 0000000..de4c1d9
--- /dev/null
+++ b/R/dotplot.mtb.R
@@ -0,0 +1,60 @@
+dotplot.mtb <- function (x, xlim = NULL, main = NULL, xlab = NULL, ylab=NULL,
+                     pch = 19, hist=FALSE, yaxis=FALSE, mtbstyle=TRUE)
+{
+    if (is.null(xlim))
+        xlim <- range(pretty(range(x,na.rm=TRUE))) 
+    if (is.null(main)) 
+        main <- ""
+    if (is.null(xlab)) 
+        xlab <- ""
+    if (is.null(ylab)) 
+        ylab <- ""
+    x <- sort(x)
+    w <- table(x)
+    if(hist) {
+        x <- as.numeric(names(w))
+        w <- unname(unclass(w))
+    } else w <- unlist(lapply(w, function(n) { 1:n }))
+    mw <- max(w)
+    Nmax <- floor(par()$pin[2]/strheight("o",units="inches"))
+    top <- if(mtbstyle) Nmax/2 else Nmax
+    if(mw <= top & !hist) {
+    	plot(range(x, na.rm = TRUE), c(0, 1), type = "n", xlab = "", 
+             ylab = "", xlim = xlim, main = main, axes = FALSE)
+	yr <- if(mtbstyle) c(-Nmax/2,Nmax/2) else c(0,Nmax)
+    	par(usr = c(par()$usr[1:2], yr[1], yr[2]))
+    	y <- strheight("o") * w
+    	points(x, y, pch = pch)
+    	axis(side = 1, pos = 0)
+	if(xlab!="") axis(side=1,at=0.5*sum(xlim),pos=-2,labels=xlab,tick=FALSE)
+	if(ylab!="") axis(side=2,at=0.5*yr[2],line=2,labels=ylab,tick=FALSE)
+	if(yaxis) {
+		b  <- max(1,ceiling(top/10))
+		ll <- 1+floor(top/b)
+		at <- seq(0,by=b,length=ll)
+		axis(side = 2,at=at)
+	}
+    } else {
+	nt <- mw+1
+	yr <- if(mtbstyle) c(-nt,nt) else c(0,nt)
+	if(hist) plot(x,w,type="h",xlab="",ylab="",xlim=xlim,
+                      ylim=yr,main=main,axes=FALSE)
+	else plot(x,w,pch=pch,xlab="",ylab="",xlim=xlim,
+                  ylim=yr,main=main,axes=FALSE)
+	pos <- if(mtbstyle) -0.02*mw else 0
+	axis(side = 1,pos = pos)
+	if(mtbstyle) {
+		if(xlab!="") axis(side=1,at=0.5*sum(xlim),pos=-2,labels=xlab,tick=FALSE)
+		if(ylab!="") axis(side=2,at=0.5*yr[2],line=2,labels=ylab,tick=FALSE)
+	} else {
+		if(xlab!="") title(xlab=xlab)
+		if(ylab!="") title(ylab=ylab)
+	}
+	if(yaxis) {
+		b  <- max(1,ceiling(nt/10))
+		ll <- 1+floor(nt/b)
+		at <- seq(0,by=b,length=ll)
+		axis(side = 2,at=at)
+	}
+    }
+}
diff --git a/R/draw.arc.R b/R/draw.arc.R
new file mode 100755
index 0000000..9beacf9
--- /dev/null
+++ b/R/draw.arc.R
@@ -0,0 +1,47 @@
+draw.arc <- function(x=1, y=NULL, radius=1, angle1=deg1*pi/180, angle2=deg2*pi/180,
+    deg1=0, deg2=45, n=0.05, col=NA, lwd=NA, ...) 
+    {
+    if (all(is.na(col)))
+        col <- par("col")
+    if (all(is.na(lwd)))
+        lwd <- par("lwd")
+    xylim<-par("usr")
+    ymult <- getYmult()
+    devunits <- dev.size("px")
+    draw.arc.0 <- function(x, y, radius, angle1, angle2, n, col, lwd, ...)
+        {
+        delta.angle <- (angle2 - angle1)
+        if (n != as.integer(n))
+            n <- as.integer(1+delta.angle/n) # Divide total angle by desired segment angle to get number of segments
+        delta.angle <- delta.angle/n
+        angleS <- angle1 + seq(0, length=n) * delta.angle
+        angleE <- c(angleS[-1], angle2)
+        # Move segment starts/ends so that segments overlap enough to make wide segments
+        # not have an open slice in them.  The slice is open by delta.angle*half.lwd.user.
+        # That subtends an angle of that/(radius+half.lwd.user) radians, from center.
+        # Move segment endpoints by half of that, so together they equal that.
+        if (n > 1)
+            {
+            half.lwd.user <- (lwd/2)*(xylim[2]-xylim[1])/devunits[1]
+            adj.angle = delta.angle*half.lwd.user/(2*(radius+half.lwd.user))
+            angleS[2:n] = angleS[2:n] - adj.angle
+            angleE[1:(n-1)] = angleE[1:(n-1)] + adj.angle
+            }
+        p1x <- x + radius * cos(angleS)
+        p1y <- y + radius * sin(angleS) * ymult
+        p2x <- x + radius * cos(angleE)
+        p2y <- y + radius * sin(angleE) * ymult
+        segments(p1x, p1y, p2x, p2y, col=col, lwd=lwd, ...)
+        }
+    xy <- xy.coords(x, y)
+    x <- xy$x
+    y <- xy$y
+    a1 <- pmin(angle1, angle2)
+    a2 <- pmax(angle1, angle2)
+    angle1 <- a1
+    angle2 <- a2
+    args <- data.frame(x, y, radius, angle1, angle2, n, col, lwd, stringsAsFactors=FALSE)
+    for (i in 1:nrow(args))
+        do.call("draw.arc.0", c(args[i, ], ...))
+    invisible(args)
+    }
diff --git a/R/draw.circle.R b/R/draw.circle.R
new file mode 100755
index 0000000..b5d2caf
--- /dev/null
+++ b/R/draw.circle.R
@@ -0,0 +1,14 @@
+draw.circle<-function(x,y,radius,nv=100,border=NULL,col=NA,lty=1,lwd=1) {
+ xylim<-par("usr")
+ plotdim<-par("pin")
+ ymult<-getYmult()
+ angle.inc<-2*pi/nv
+ angles<-seq(0,2*pi-angle.inc,by=angle.inc)
+ if(length(col) < length(radius)) col<-rep(col,length.out=length(radius))
+ for(circle in 1:length(radius)) {
+  xv<-cos(angles)*radius[circle]+x
+  yv<-sin(angles)*radius[circle]*ymult+y
+  polygon(xv,yv,border=border,col=col[circle],lty=lty,lwd=lwd)
+ }
+ invisible(list(x=xv,y=yv))
+}
diff --git a/R/draw.ellipse.R b/R/draw.ellipse.R
new file mode 100755
index 0000000..c9e051d
--- /dev/null
+++ b/R/draw.ellipse.R
@@ -0,0 +1,78 @@
+draw.ellipse<-function(x,y,a=1,b=1,angle=0,segment=NULL,arc.only=TRUE, 
+ deg=TRUE,nv=100,border=NULL,col=NA,lty=1,lwd=1,...) {
+
+    if(is.null(segment)) {
+     # set segment to full ellipse if not supplied
+     if(deg) segment<-c(0,360)
+     else segment<-c(0,2*pi)
+    }
+    ## workhorse internal function draw ellipse
+    draw1ellipse <-
+    function(x, y, a = 1, b = 1, angle = 0, segment=NULL, 
+    arc.only=TRUE, nv = 100, deg = TRUE, border=NULL, col=NA, lty=1, lwd=1, ...)
+    {
+        # if input is in degrees
+        if (deg) {
+            angle <- angle * pi/180
+            segment <- segment * pi/180
+        }
+        z <- seq(segment[1], segment[2], length = nv + 1)
+        xx <- a * cos(z)
+        yy <- b * sin(z)
+        alpha <- xyangle(xx, yy, directed = TRUE, deg = FALSE)
+        rad <- sqrt(xx^2 + yy^2)
+        xp <- rad * cos(alpha + angle) + x
+        yp <- rad * sin(alpha + angle) + y
+        if (!arc.only) {
+            xp <- c(x, xp, x)
+            yp <- c(y, yp, y)
+        }
+        polygon(xp, yp, border=border, col=col, lty=lty, lwd=lwd, ...)
+        invisible(NULL)
+    }
+    ## internal function for the internal function
+    xyangle <-
+    function(x, y, directed = FALSE, deg = TRUE)
+    {
+        if (missing(y)) {
+            y <- x[,2]
+            x <- x[,1]
+        }
+        out <- atan2(y, x)
+        if (!directed)
+            out <- out %% pi   
+        if (deg) # if output is desired in degrees
+            out <- out * 180 / pi
+        out
+    }
+    if (missing(y)) {
+        y <- x[,2]
+        x <- x[,1]
+    }
+    n <- length(x)
+    if (length(a) < n)
+        a <- rep(a, n)[1:n]
+    if (length(b) < n)
+        b <- rep(b, n)[1:n]
+    if (length(angle) < n)
+        angle <- rep(angle, n)[1:n]
+    if (length(col) < n)
+        col <- rep(col, n)[1:n]
+    if (length(border) < n)
+        border <- rep(border, n)[1:n]
+    if (length(nv) < n)
+        nv <- rep(nv, n)[1:n]
+    if(n==1)
+     draw1ellipse(x,y,a,b,angle=angle,segment=segment,
+      arc.only=arc.only,deg=deg,nv=nv,col=col,border=border,
+      lty=lty,lwd=lwd,...)
+    else {
+     if (length(segment) < 2*n)
+        segment <- matrix(rep(segment,n), n, 2, byrow=TRUE)
+     lapply(1:n, function(i) draw1ellipse(x[i], y[i], a[i], b[i], 
+      angle=angle[i], segment=segment[i,], arc.only=arc.only, deg=deg, 
+      nv=nv[i], col=col[i], border=border[i],
+      lty=lty, lwd=lwd, ...))
+    }
+    invisible(NULL)
+}
diff --git a/R/draw.radial.line.R b/R/draw.radial.line.R
new file mode 100644
index 0000000..0b8365a
--- /dev/null
+++ b/R/draw.radial.line.R
@@ -0,0 +1,32 @@
+draw.radial.line <- function(start, end, center=c(0, 0), angle=0, deg=NA, expand=FALSE,
+    col=NA, lwd=NA, ...) 
+    {
+    if (is.na(col))
+        col <- par("col")
+    if (is.na(lwd))
+        lwd <- par("lwd")
+    if (is.na(deg))
+        deg <- angle*180/pi
+    angle <- deg*pi/180
+    cosang <- cos(angle)
+    sinang <- sin(angle)
+    xylim <- par("usr")
+    plotdim <- par("pin")
+    ymult <- (xylim[4] - xylim[3])/(xylim[2] - xylim[1]) * plotdim[1]/plotdim[2]
+    if (!expand || end <= 0)
+        {
+        px <- c(start, end)
+        lines(center[1]+px*cosang, center[2]+px*sinang*ymult, col=col, lwd=lwd, ...)
+        }
+    else
+        {
+        devunits <- dev.size("px")
+        lwdend <- (lwd/2)*(xylim[2]-xylim[1])/devunits[1]
+        px <- c(start, start, end, end)
+        lwdstart <- lwdend * start/end
+        py <- c(lwdstart, -lwdstart, -lwdend, lwdend)
+        pxt <- center[1] + px*cosang - py*sinang*ymult
+        pyt <- center[2] + px*sinang + py*cosang*ymult
+        polygon(pxt, pyt, border=col, col=col)
+        }
+    }
diff --git a/R/drawNestedBars.R b/R/drawNestedBars.R
new file mode 100755
index 0000000..1533895
--- /dev/null
+++ b/R/drawNestedBars.R
@@ -0,0 +1,63 @@
+drawNestedBars<-function(x,start,end,shrink=0.1,errbars=FALSE,
+ intervals=TRUE,col=NA,labelcex=1,lineht=NA,showall=TRUE,Nwidths=FALSE,
+ barlabels=NULL,showlabels=TRUE,arrow.cap=NA) {
+
+ barcol<-ifelse(is.list(col),col[[1]],col)
+ # may be only one bar per call
+ if(!is.null(x[[1]][[1]]) && (showall || length(x[[1]])==1))
+  rect(start,0,end,unlist(x[[1]][[1]]),col=barcol)
+ if(showlabels && !is.null(x[[1]][[1]])) {
+  if(!is.null(barlabels)) barlabel<-barlabels[[1]]
+  else
+   barlabel<-names(x[[1]][[1]])
+  labely<--lineht*length(x[[1]])
+  # zero length bar label suppresses this
+  if(nchar(barlabels[[1]][1])) {
+   par(xpd=TRUE)
+   segments(c(start,end,start),c(0,0,labely),c(start,end,end),rep(labely,3))
+   boxed.labels((start+end)/2,labely,barlabel,ypad=1.4,
+    bg=ifelse(is.na(barcol),"white",barcol),cex=labelcex)
+   par(xpd=FALSE)
+  }
+ }
+ if(errbars && length(x[[1]])==1)
+  dispersion((start+end)/2,x[[1]][[1]],x[[2]][[1]],x[[3]][[1]],
+   intervals=intervals,arrow.cap=arrow.cap)
+ # remove the first component of each element of x displayed above
+ for(xcomp in 1:length(x)) x[[xcomp]][[1]]<-NULL
+ # if there are any more bars to display, set up the call
+ if(length(x[[1]])) {
+  # number of values in the new first component of x 
+  nvalues<-length(unlist(x[[1]][[1]]))
+  # drop the color of the last bar
+  if(is.list(col)) col[[1]]<-NULL
+  # drop the top level barlabels if present
+  if(!is.null(barlabels) && length(barlabels) > 1) barlabels[[1]]<-NULL
+  # width of all the spaces between the next group of bars
+  barspace<-(end-start)*shrink
+  # width of the bars
+  if(Nwidths)
+   barwidth<-((end-start)-barspace)*x[[4]][[1]]/sum(x[[4]][[1]])
+  else barwidth<-rep(((end-start)-barspace)/nvalues,nvalues)
+  # width of each space between bars
+  barspace<-barspace/(nvalues+1)
+  # step through the values for this group of bars
+  for(nextval in 1:nvalues) {
+   newx<-list()
+   # slice the x arrays for this set of values
+   for(xcomp in 1:length(x))
+    newx[[xcomp]]<-lapply(x[[xcomp]],sliceArray,nextval)
+   newbarlabels<-barlabels
+   start<-start+barspace
+   newcol<-col
+   if(is.list(col)) newcol[[1]]<-col[[1]][nextval]
+   if(!is.null(barlabels)) newbarlabels[[1]]<-barlabels[[1]][nextval]
+   drawNestedBars(newx,start,start+barwidth[nextval],shrink=shrink,
+    errbars=errbars,col=newcol,labelcex=labelcex,lineht=lineht,
+    showall=showall,Nwidths=Nwidths,barlabels=newbarlabels,
+    showlabels=showlabels,arrow.cap=arrow.cap,intervals=intervals)
+   #else print(newx)
+   start<-start+barwidth[nextval]
+  }
+ }
+}
diff --git a/R/ehplot.R b/R/ehplot.R
new file mode 100644
index 0000000..5af488e
--- /dev/null
+++ b/R/ehplot.R
@@ -0,0 +1,52 @@
+ehplot <-
+function (data, groups, intervals = 50, offset = 0.1, log = FALSE, 
+    median = TRUE, box = FALSE, boxborder = "grey50", xlab = "groups", 
+    ylab = "values", col = "black", add = FALSE, sort = TRUE, 
+    ...) 
+{
+    stopifnot(length(data) == length(groups), is.numeric(data), 
+        intervals > 0, offset < 0.4)
+    grps <- split(data, groups, drop = TRUE)
+    if (sort) {
+        grouporder <- 1:length(grps)
+    }
+    else {
+        grouporder <- rank(unique(groups))
+    }
+    dr <- range(data, finite = TRUE)
+    if (log) {
+        seps <- dr[1] * exp((0:intervals) * log(dr[2]/dr[1])/intervals)
+    }
+    else {
+        seps <- (0:intervals) * (diff(dr)/intervals) + dr[1]
+    }
+    inc <- rep(1:(0.4/offset), each = 2)
+    xshift <- list(even = c((inc - 0.5) * offset * (-1)^(1:length(inc))), 
+        odd = c(0, inc * offset * (-1)^(1:length(inc))))
+    pnts_a <- list()
+    for (i in 1:length(grps)) {
+        tgrp <- grps[[grouporder[i]]]
+        histo <- hist(tgrp, breaks = seps, plot = FALSE)$counts
+        ixof <- unlist(sapply(histo, function(j) {
+            rep(xshift[[j%%2 + 1]], length.out = j)
+        }))
+        pnts_a[[i]] <- i + ixof[rank(tgrp, ties.method = "first")]
+        if (anyDuplicated(na.omit(cbind(tgrp, pnts_a[[i]])))) 
+            warning("Some points are overplotted in group ", 
+                names(grps)[grouporder[i]], ". Please consider using a lower offset-value.")
+    }
+    if (!add) {
+        plot(data, xlim = c(0.5, length(grps) + 0.5), xaxt = "n", 
+            type = "n", xlab = xlab, ylab = ylab, log = ifelse(log, 
+                "y", ""), ...)
+        axis(1, at = grouporder, labels = names(grps), ...)
+    }
+    if (box) 
+        boxplot(data ~ groups, border = boxborder, at = grouporder, 
+            add = TRUE, axes = FALSE, outline = FALSE)
+    points(unsplit(pnts_a[grouporder], groups, drop = TRUE), 
+        data, col = col, ...)
+    if (median) 
+        lines(rep(grouporder, each = 3) + c(-0.4, 0.4, NA), rep(sapply(grps, 
+            median, na.rm = TRUE), each = 3) + c(0, 0, NA), lwd = 3)
+}
diff --git a/R/election.R b/R/election.R
new file mode 100644
index 0000000..dd6b689
--- /dev/null
+++ b/R/election.R
@@ -0,0 +1,27 @@
+seats<-function (N, M, r0 = 2.5) {
+ radii <- seq(r0, 1, len = M)
+ counts <- numeric(M)
+ pts <- do.call(rbind, lapply(1:M,
+  function(i) {
+   counts[i] <<- round(N * radii[i]/sum(radii[i:M]))
+   theta <- seq(0, pi, len = counts[i])
+   N <<- N - counts[i]
+   data.frame(x = radii[i] * cos(theta), y = radii[i] * 
+   sin(theta), r = i, theta = theta)
+  }
+ )
+ )
+ pts <- pts[order(-pts$theta, -pts$r), ]
+ pts
+}
+
+election<-function (seats, result, formula,
+ colours = sample(rainbow(length(counts)))) {
+ 
+ result <- model.frame(formula, result)
+ counts <- result[, 2]
+ stopifnot(sum(counts) == nrow(seats))
+ seats$party <- factor(rep(result[, 1], counts))
+ seats$colour <- colours[as.numeric(seats$party)]
+ seats
+}
diff --git a/R/emptyspace.R b/R/emptyspace.R
new file mode 100755
index 0000000..6f31127
--- /dev/null
+++ b/R/emptyspace.R
@@ -0,0 +1,79 @@
+emptyspace<-function(x,y=NULL) {
+ xlim<-par("usr")[1:2]
+ ylim<-par("usr")[3:4]
+ if(is.null(y)) {
+  if(is.list(x)) {
+   # trust me, I'm a list
+   y<-as.vector(x[[2]])
+   x<-as.vector(x[[1]])
+  }
+  else stop("both x and y values must be supplied")
+ }
+ xyna<-which(is.na(x) | is.na(y))
+ if(any(xyna)) {
+  # get rid of any NAs
+  x<-x[-xyna]
+  y<-y[-xyna]
+ }
+ # check for negative values and offset them out
+ xoffset<-yoffset<-0
+ if(any(x < 0)) {
+  xoffset<-min(x)
+  x<-x-xoffset
+  xlim<-xlim-xoffset
+ }
+ if(any(y < 0)) {
+  yoffset<-min(y)
+  y<-y-yoffset
+  ylim<-ylim-yoffset
+ }
+ # here begins Ray Brownrigg's code
+ ox<-order(x)
+ x<-x[ox]
+ y<-y[ox]
+ x<-c(xlim[1],x,xlim[2])
+ y<-c(ylim[1],y,ylim[2])
+ omaxa<-0
+ halfxspan<-diff(xlim)/2
+ halfyspan<-diff(ylim)/2
+ # added braces here for clarity
+ for(i in 1:(length(x)-1)) {
+  for(j in (i+1):length(x)) {
+   x1<-x[i]
+   x2<-x[j]
+   XX<-x2 - x1
+   # if(XX > halfxspan) break
+   yy<-c(ylim[1],y[(i+1):(j-1)],ylim[2])
+   oyy<-order(yy)
+   yy<-yy[oyy]
+   dyy<-diff(yy)
+   # whichdyy<-(dyy <= halfyspan) & (dyy >= 0.5*XX) & (dyy <= 2*XX)
+   # the next line fixes the problem with very large empty spaces
+   whichdyy<-(dyy >= 0.5*XX) & (dyy <= 2*XX)
+   wy1<-yy[whichdyy]
+   if(length(wy1) > 0) {
+    wy2<-yy[(1:length(dyy))[whichdyy]+1]
+    k<-which.max(dyy[whichdyy])
+    maxa<-(x2-x1)*(wy2[k]-wy1[k])
+    if(maxa > omaxa) {
+     omaxa<-maxa
+     mx1<-x1
+     mx2<-x2
+     my1<-wy1[k]
+     my2<-wy2[k]
+    }
+   }
+  }
+ }
+ # if offsets were used, remove them from the final values
+ if(xoffset < 0) {
+  mx1<-mx1+xoffset
+  mx2<-mx2+xoffset
+ }
+ if(yoffset < 0) {
+  my1<-my1+yoffset
+  my2<-my2+yoffset
+ }
+ # return the center of the rectangle
+ return(list(x=(mx1+mx2)/2,y=(my1+my2)/2))
+}
diff --git a/R/fan.plot.R b/R/fan.plot.R
new file mode 100755
index 0000000..20ada9b
--- /dev/null
+++ b/R/fan.plot.R
@@ -0,0 +1,113 @@
+fan.plot<-function (x,edges=200,radius=1,col=NULL,align.at=NULL, 
+ max.span=NULL,labels=NULL,labelpos=NULL,label.radius=1.2,align="left", 
+ shrink=0.02,main="",ticks=NULL,include.sumx=FALSE,...) {
+
+ if(!is.numeric(x) || any(is.na(x) | x <= 0)) 
+  stop("fan.plot: x values must be positive.")
+ nticks<-ifelse(ticks==1,sum(x),ticks)
+ if(include.sumx) x<-c(x,sum(x))
+ xorder<-order(x, decreasing = TRUE)
+ oldmar<-par("mar")
+ # convert values into angular extents
+ if (align == "center") x<-pi*x/sum(x)
+ else x<-2*pi*x/sum(x)
+ # stretch or shrink the values if max.span has been specified
+ if(!is.null(max.span)) x<-x*max.span/max(x)
+ if(is.null(align.at)) {
+  if(align == "center") align.at<-pi/2
+  if(align == "right") align.at<-(pi - x[xorder[1]])/2
+  if(align == "left") align.at<-(pi + x[xorder[1]])/2
+ }
+ nx<-length(x)
+ tempradius<-radius
+ if(is.null(col)) col<-rainbow(nx)
+ else if (length(col) < nx) col<-rep(col,length = nx)
+ if(align == "left") lowpoint<-min(sin(align.at-x))
+ else lowpoint<-min(sin(align.at+x))
+ if(lowpoint > 0) lowpoint<-0
+ par(mar=c(1,1,1,1),xpd=TRUE)
+ xspan<-max(label.radius+0.012*max(nchar(labels)))
+ plot(0,xlim=c(-xspan,xspan),ylim=c(lowpoint,xspan), 
+  xlab="",ylab="",type="n",axes=FALSE)
+ xy<-par("usr")
+ pinxy<-par("pin")
+ ymult<-(xy[4]-xy[3])/(xy[2]-xy[1])*(pinxy[1]/pinxy[2])
+ if(nchar(main)) 
+  text(0,(max(label.radius)+0.2)*ymult,main,cex=1.5,adj=c(0.5,1))
+ for(i in 1:nx) {
+  n<-edges*x[xorder[i]]/pi
+  if(align == "center") 
+   t2p<-seq(align.at-x[xorder[i]],align.at+x[xorder[i]],length=n)
+  if (align == "right") 
+   t2p<-seq(align.at,align.at+x[xorder[i]],length=n)
+  if(align=="left") 
+   t2p<-seq(align.at-x[xorder[i]],align.at,length=n)
+  xc<-c(cos(t2p)*tempradius,0)
+  yc<-c(sin(t2p)*tempradius*ymult,0)
+  polygon(xc,yc,col=col[xorder[i]],...)
+  tempradius<-tempradius-shrink
+ }
+ if(!is.null(ticks)) {
+  if(align == "left")
+   tickles<-seq(align.at,align.at-x[xorder[1]],by=-sum(x)/ticks)
+  if(align == "right") 
+   tickles<-seq(align.at,align.at+x[xorder[1]],by=sum(x)/ticks)
+  if(align == "center") 
+   tickles<-c(seq(align.at,align.at+x[xorder[1]],by=sum(x)/(2*ticks)),
+    seq(align.at,align.at-x[xorder[1]],by=-sum(x)/(2*ticks)))
+  stickout<-rep(c(0.04,rep(0.02,4),0.03,rep(0.02,4)),
+   length.out=length(tickles))
+  xpos1<-cos(tickles) * (radius + stickout)
+  ypos1<-sin(tickles) * ymult * (radius + stickout)
+  xpos2<-cos(tickles) * radius
+  ypos2<-sin(tickles) * ymult * radius
+  segments(xpos1, ypos1, xpos2, ypos2)
+ }
+ if(!is.null(labels)) {
+  par(xpd=TRUE)
+  if(align == "center") {
+   labelside<-rep(c(1, -1),length.out=nx-1)
+   lpos<-c(align.at+labelside*(x[xorder[1:(nx-1)]]+
+    (x[xorder[2:nx]]-x[xorder[1:(nx-1)]])/2),align.at)
+  }
+  if(align == "right") {
+   lpos<-align.at+(x[xorder]-c((x[xorder[1:(nx-1)]]-
+    x[xorder[2:nx]])/2,x[xorder[nx]]/2))
+   labelside<-rep(1,nx)
+  }
+  if(align == "left") {
+   lpos<-align.at-(x[xorder]-c((x[xorder[1:(nx-1)]]-
+    x[xorder[2:nx]])/2,x[xorder[nx]]/2))
+   labelside<-rep(-1,nx)
+  }
+  if(is.null(labelpos)) {
+   labelpos<-lpos
+   ldiff<-abs(diff(labelpos))
+   squeezers<-which(ldiff<0.15)
+   if(length(squeezers)) {
+    for(squeeze in squeezers) {
+     labelpos[1:squeeze]<-labelpos[1:squeeze]+
+      (0.15-ldiff[squeeze]) * labelside[1:squeeze]
+     labelpos[(squeeze+1):nx]<-labelpos[(squeeze+1):nx]-
+      (0.15-ldiff[squeeze]) * labelside[(squeeze+1):nx]
+    }
+   }
+  }
+  innerend<-seq(0.98,by=-shrink,length=nx)
+  endpos<-lpos
+  if(length(label.radius) < nx) 
+   label.radius<-rep(label.radius,length.out=nx)
+  xpos1<-cos(labelpos)*label.radius[xorder]
+  ypos1<-sin(labelpos)*ymult*label.radius[xorder]
+  for(i in 1:nx)
+   boxed.labels(xpos1[i],ypos1[i],labels[xorder[i]], 
+    border=FALSE,xpad=0,ypad=0.1,adj=c(0.5-cos(labelpos[i])/2.5,0.5))
+  xpos1<-cos(labelpos)*(label.radius[xorder]+radius)/2
+  ypos1<-sin(labelpos)*ymult*(label.radius[xorder]+radius)/2
+  xpos2<-cos(endpos)*radius*innerend
+  ypos2<-sin(endpos)*ymult*radius*innerend
+  segments(xpos1,ypos1,xpos2,ypos2)
+ }
+ par(mar=oldmar,xpd=FALSE)
+ invisible(labelpos)
+}
diff --git a/R/feather.plot.R b/R/feather.plot.R
new file mode 100755
index 0000000..29da964
--- /dev/null
+++ b/R/feather.plot.R
@@ -0,0 +1,25 @@
+feather.plot<-function(r,theta,xpos,yref=0,use.arrows=TRUE,
+ col.refline="lightgray",fp.type="s",main="",xlab="",ylab="",
+ xlabels=NULL,...) {
+
+ if(missing(xpos)) xpos<-1:length(theta)
+ # reverse the angles and start at 12 o'clock
+ if(fp.type == "m") theta<-5*pi/2-theta
+ x<-r*cos(theta)
+ y<-r*sin(theta)
+ xmult<-diff(range(xpos))/(diff(range(y))*2)
+ x<-x*xmult
+ xlim<-range(c(xpos,x+xpos))
+ ylim<-range(c(y,yref))
+ oldpin<-par("pin")
+ xdiff<-xlim[2]-xlim[1]
+ ydiff<-ylim[2]-ylim[1]
+ plot(0,xlim=xlim,ylim=ylim,type="n",main=main,xlab=xlab,ylab=ylab,axes=FALSE)
+ box()
+ if(is.null(xlabels)) axis(1)
+ else axis(1,at=xpos,labels=xlabels)
+ abline(h=yref,col=col.refline)
+ if(use.arrows) arrows(xpos,yref,xpos+x,y,length=0.1,...)
+ else segments(xpos,yref,xpos+x,y,...)
+ par(pin=oldpin)
+}
diff --git a/R/floatpie.R b/R/floatpie.R
new file mode 100755
index 0000000..646d278
--- /dev/null
+++ b/R/floatpie.R
@@ -0,0 +1,63 @@
+# display a pie chart at an arbitrary location on an existing plot
+
+floating.pie<-function(xpos,ypos,x,edges=200,radius=1,col=NULL,
+ startpos=0,shadow=FALSE,shadow.col=c("#ffffff","#cccccc"),...) {
+
+ if (!is.numeric(x)) stop("floating.pie: x values must be numeric.")
+ validx<-which(!is.na(x) & x > 0)
+ x<-c(0,cumsum(x[validx])/sum(x[validx]))
+ dx<-diff(x)
+ nx<-length(dx)
+ if (is.null(col)) col<-rainbow(nx)
+ else if(length(col) < nx) col<-rep(col,nx)
+ # scale the y radius
+ xylim<-par("usr")
+ plotdim<-par("pin")
+ yradius<-radius*(xylim[4]-xylim[3])/(xylim[2]-xylim[1])*plotdim[1]/plotdim[2]
+ # get the center values in radians
+ bc<-2*pi*(x[1:nx]+dx/2)+startpos
+ if(shadow) {
+  xc<-c(cos(seq(0,2*pi,length=edges))*radius+xpos)
+  yc<-c(sin(seq(0,2*pi,length=edges))*yradius+ypos)
+  polygon.shadow(xc,yc,col=shadow.col)
+ }
+ for(i in 1:nx) {
+  n<-max(2,floor(edges*dx[i]))
+  t2p<-2*pi*seq(x[i],x[i+1],length=n)+startpos
+  xc<-c(cos(t2p)*radius+xpos,xpos)
+  yc<-c(sin(t2p)*yradius+ypos,ypos)
+  polygon(xc,yc,col=col[i],...)
+  t2p<-2*pi*mean(x[i+0:1])+startpos
+  xc<-cos(t2p)*radius
+  yc<-sin(t2p)*radius
+ }
+ invisible(bc)
+}
+
+# place plain or boxed labels at the specified distance from x,y on the
+# radial lines specified by angles.
+
+pie.labels<-function(x,y,angles,labels,radius=1.05,bg="white",border=TRUE,
+ minangle=NA,boxed=FALSE,...) {
+
+ if(nargs()<4)
+  stop("Usage: pie.labels(x,y,angles,labels,radius=1,bg=\"white\",border=TRUE,...)")
+ # turn off clipping
+ par(xpd=TRUE)
+ # scale the y radius
+ xylim<-par("usr")
+ plotdim<-par("pin")
+ yradius<-radius*(xylim[4]-xylim[3])/(xylim[2]-xylim[1])*plotdim[1]/plotdim[2]
+ if(!is.na(minangle)) angles<-spreadout(angles,minangle)
+ xc<-cos(angles)*radius+x
+ yc<-sin(angles)*yradius+y
+ for(label in 1:length(labels)) {
+  label.adj<-c(abs(1-cos(angles[label]))/2,abs(1-sin(angles[label]))/2)
+  if(boxed)
+   boxed.labels(xc[label],yc[label],labels[label],adj=label.adj,
+    border=border,...)
+  else text(xc[label],yc[label],labels[label],adj=label.adj,...)
+ }
+ # turn clipping back on
+ par(xpd=FALSE)
+}
diff --git a/R/fullaxis.R b/R/fullaxis.R
new file mode 100755
index 0000000..5d5d412
--- /dev/null
+++ b/R/fullaxis.R
@@ -0,0 +1,18 @@
+fullaxis<-function(side=1,at=NULL,labels=TRUE,line=NA,pos=NA,outer=FALSE,
+ font=NA,lty="solid",lwd=1,lwd.ticks=lwd,col=NULL,col.ticks=NULL,
+ hadj=NA,padj=NA,...) {
+
+ xylim<-par("usr")
+ if(!is.na(pos)) xylim[c(3,1,4,2)[side]]<-pos
+ par(xpd=TRUE)
+ switch(side,
+  segments(xylim[1],xylim[3],xylim[2],xylim[3],col=col,lty=lty,lwd=lwd),
+  segments(xylim[1],xylim[3],xylim[1],xylim[4],col=col,lty=lty,lwd=lwd),
+  segments(xylim[1],xylim[4],xylim[2],xylim[4],col=col,lty=lty,lwd=lwd),
+  segments(xylim[2],xylim[3],xylim[2],xylim[4],col=col,lty=lty,lwd=lwd))
+ par(xpd=FALSE)
+ axpos<-axis(side=side,at=at,labels=labels,line=line,pos=pos,outer=outer,
+  font=font,lty=lty,lwd=lwd,col=col,col.ticks=col.ticks,
+  hadj=hadj,padj=padj,...)
+ invisible(axpos)
+}
diff --git a/R/gantt.R b/R/gantt.R
new file mode 100755
index 0000000..c4d3292
--- /dev/null
+++ b/R/gantt.R
@@ -0,0 +1,124 @@
+get.gantt.info<-function(format="%Y/%m/%d") {
+ cat("Enter the label, start and finish time for each task.\n")
+ cat("Default format for time is year/month/day e.g. 2005/2/22\n")
+ cat("Enter a blank label to end.\n")
+ nextlabel<-"dummy"
+ tasklabels<-NA
+ taskstarts<-NA
+ taskends<-NA
+ priorities<-NA
+ while(nchar(nextlabel)) {
+  nextlabel<-readline("Task label - ")
+  if(nchar(nextlabel)) {
+   if(is.na(tasklabels[1])) tasklabels<-nextlabel
+   else tasklabels<-c(tasklabels,nextlabel)
+   nextstart<-as.POSIXct(strptime(readline("Task begins - "),format=format))
+   if(is.na(taskstarts[1])) taskstarts<-nextstart
+   else taskstarts<-c(taskstarts,nextstart)
+   nextend<-nextstart-1
+   while(nextend < nextstart) {
+    nextend<-as.POSIXct(strptime(readline("Task ends - "),format=format))
+    if(nextend < nextstart) cat("Task cannot end before it starts!\n")
+    else {
+     if(is.na(taskends[1])) taskends<-nextend
+     else taskends<-c(taskends,nextend)
+    }
+   }
+   nextpriority<-0
+   while (nextpriority < 1 || nextpriority > 10) {
+    nextpriority <- as.numeric(readline("Task priority (1-10) - "))
+    if(is.na(nextpriority)) {
+     cat("Task priority must be a number between 1 and 10!\n")
+     next.priority<-0
+    }
+   }
+   if(is.na(priorities[1])) priorities<-nextpriority
+   else priorities<-c(priorities,nextpriority)
+  }
+ }
+ return(list(labels=tasklabels,starts=taskstarts,ends=taskends,
+  priorities=priorities))
+}
+
+gantt.chart<-function (x=NULL,format="%Y/%m/%d",xlim=NULL,
+ taskcolors=NULL,priority.legend=FALSE,vgridpos=NULL,vgridlab=NULL, 
+ vgrid.format="%Y/%m/%d",half.height=0.25,hgrid=FALSE,main="",xlab="",
+ cylindrical=FALSE,label.cex=1,border.col=NA,priority.label="Priorities",
+ priority.extremes=c("High","Low"),time.axis=3) {
+ 
+ oldpar <- par("mai", "omi", "xpd", "xaxs", "yaxs")
+ if(is.null(x)) x<-get.gantt.info(format=format)
+ if(any(x$starts > x$ends)) 
+  stop("Can't have a start date after an end date")
+ tasks<-unique(x$labels)
+ ntasks<-length(tasks)
+ if(is.null(x$priorities)) x$priorities<-rep(1,ntasks)
+ if (is.null(dev.list())) plot.new()
+ charheight<-strheight("M",units="inches")
+ oldcex<-par(cex=label.cex)
+ maxwidth<-max(strwidth(x$labels,units="inches")) + 0.3
+ par(oldcex)
+ if(is.null(xlim)) xlim<-range(c(x$starts,x$ends))
+ npriorities<-max(x$priorities)
+ if(is.null(taskcolors)) taskcolors<-barcolors<-rainbow(npriorities)
+ else barcolors <- taskcolors
+ if(length(barcolors) < ntasks) barcolors<-barcolors[x$priorities]
+ nlabels<-length(x$labels)
+ bottom.margin <- ifelse(time.axis == 3, 0.8, 1.3)
+ if(length(barcolors) < nlabels) 
+  barcolors<-barcolors[as.numeric(factor(x$labels))]
+ par(mai=c(bottom.margin,maxwidth,charheight*5,0.1))
+ par(omi=c(0.1,0.1,0.1,0.1),xaxs="i",yaxs="i")
+ plot(range(x$starts),c(1,ntasks),xlim=xlim,ylim=c(0.5,ntasks+0.5),
+ main="",xlab="",ylab="",axes=FALSE,type = "n")
+ box()
+ if(nchar(main)) mtext(main,3,2,at=getFigCtr()[1])
+ if(nchar(xlab)) mtext(xlab,1,1)
+ if(is.na(vgrid.format)) {
+  if(is.null(vgridlab)) vgridlab<-vgridpos
+  axis(time.axis,at=vgridpos,labels=vgridlab,padj=0)
+  tickpos<-vgridpos
+ }
+ else {
+  if(is.null(vgridpos)) 
+   tickpos<-axis.POSIXct(3,xlim,format=vgrid.format)
+  else tickpos<-vgridpos
+  if(is.null(vgridlab) && !is.null(vgridpos)) 
+   vgridlab<-format.POSIXct(vgridpos,vgrid.format)
+  if(is.null(vgridlab)) 
+   axis.POSIXct(3,xlim,format=vgrid.format)
+  else axis(time.axis,at=tickpos,labels=vgridlab,padj=0)
+ }
+ topdown<-seq(ntasks,1)
+ axis(2,at=topdown,labels=tasks,las=2,cex.axis=label.cex)
+ abline(v=tickpos,col="darkgray",lty=3)
+ for(i in 1:ntasks) {
+  if(cylindrical) 
+   cylindrect(x$starts[x$labels==tasks[i]],topdown[i] - 
+    half.height,x$ends[x$labels==tasks[i]],topdown[i] + 
+    half.height,col=barcolors[i],gradient="y")
+  else rect(x$starts[x$labels==tasks[i]],topdown[i] - 
+   half.height,x$ends[x$labels==tasks[i]],topdown[i]+half.height,
+   col=barcolors[x$labels==tasks[i]],border=border.col)
+ }
+ if(hgrid) 
+  abline(h=(topdown[1:(ntasks-1)]+topdown[2:ntasks])/2, 
+   col="darkgray",lty=3)
+ if(priority.legend) {
+  par(xpd=TRUE)
+  plim<-par("usr")
+  plot.width<-diff(plim[1:2])
+  line.height<-strheight("W")
+  color.legend(plim[1]+2*plot.width/5,
+   plim[3]-(6.5-time.axis)*line.height,
+   plim[1]+3*plot.width/5,plim[3]-(5.5-time.axis)*line.height,
+   legend=c("High",rep("",length(taskcolors)-2),"Low"),
+   rect.col=taskcolors)
+  par(xpd=NA)
+  text(plim[1]+plot.width/2,plim[3]-(7-time.axis)*line.height,
+   priority.label,adj=c(0.5,1))
+  par(xpd = FALSE)
+ }
+ par(oldpar)
+ invisible(x)
+}
diff --git a/R/gap.barplot.R b/R/gap.barplot.R
new file mode 100755
index 0000000..9f9c031
--- /dev/null
+++ b/R/gap.barplot.R
@@ -0,0 +1,59 @@
+gap.barplot<-function (y,gap,xaxlab,xtics,yaxlab,ytics,xlim=NA,ylim=NA,
+ xlab=NULL,ylab=NULL,horiz=FALSE,col=NULL,...) {
+ if (missing(y)) stop("y values required")
+ if(missing(xtics)) xtics <- 1:length(y)
+ if (missing(gap)) stop("gap must be specified")
+ if (is.null(ylab)) ylab <- deparse(substitute(y))
+ if (is.null(col)) col <- color.gradient(c(0,1),c(0,1,0),c(1,0),length(y))
+ else if(length(col) < length(y)) rep(col,length.out=length(y))
+ littleones <- which(y <= gap[1])
+ bigones <- which(y >= gap[2])
+ valid.y<-y[!is.na(y)]
+ if(any(valid.y > gap[1] & valid.y < gap[2]))
+  warning("gap includes some values of y")
+ gapsize <- gap[2] - gap[1]
+ if(missing(xaxlab)) xaxlab <- as.character(xtics)
+ if(is.na(xlim[1])) xlim <- range(xtics)
+ if(is.na(ylim[1])) ylim <- c(min(valid.y)-gapsize,max(valid.y)-gapsize)
+ if(ylim[1] < 0) ylim[1]<-0
+ if(missing(ytics)) ytics <- pretty(y)
+ if(any(ytics<0)) ytics<-ytics[ytics >= 0]
+ if(missing(yaxlab)) yaxlab <- ytics
+ littletics <- which(ytics < gap[1])
+ bigtics <- which(ytics >= gap[2])
+ halfwidth <- min(diff(xtics))/2
+ if(horiz) {
+  if(!is.null(xlab)) {
+   tmplab<-xlab
+   xlab<-ylab
+   ylab<-tmplab
+  }
+  plot(0,xlim=ylim,ylim=xlim,xlab=xlab,ylab=ylab,axes=FALSE,type="n",...)
+  plot.lim <- par("usr")
+  botgap<-ifelse(gap[1]<0,gap[1],ylim[1])
+  box()
+  axis(2,at=xtics,labels=xaxlab,...)
+  axis(1,at=c(ytics[littletics],ytics[bigtics]-gapsize),
+   labels=c(yaxlab[littletics],yaxlab[bigtics]),...)
+  rect(botgap,xtics[y<gap[1]] - halfwidth,y[y<gap[1]],
+   xtics[y<gap[1]] + halfwidth,col=col[y<gap[1]])
+  rect(botgap,xtics[bigones] - halfwidth,y[bigones]-gapsize,
+   xtics[bigones] + halfwidth,col=col[bigones])
+  axis.break(1,gap[1],style="gap")
+ }
+ else {
+  plot(0,xlim=xlim,ylim=ylim,xlab=xlab,ylab=ylab,axes=FALSE,type="n",...)
+  plot.lim <- par("usr")
+  botgap<-ylim[1]
+  box()
+  axis(1,at=xtics,labels=xaxlab,...)
+  axis(2,at=c(ytics[littletics],ytics[bigtics] - gapsize),
+   labels=c(yaxlab[littletics],yaxlab[bigtics]),...)
+  rect(xtics[littleones] - halfwidth,botgap,
+   xtics[littleones] + halfwidth,y[littleones],col=col[littleones])
+  rect(xtics[bigones] - halfwidth,botgap,xtics[bigones] + halfwidth,
+   y[bigones]-gapsize,col=col[bigones])
+  axis.break(2,gap[1],style="gap")
+ }
+ invisible(xtics)
+}
diff --git a/R/gap.boxplot.R b/R/gap.boxplot.R
new file mode 100755
index 0000000..962c168
--- /dev/null
+++ b/R/gap.boxplot.R
@@ -0,0 +1,102 @@
+gap.boxplot<-function (x,...,gap=list(top=c(NA,NA),bottom=c(NA,NA)),
+ range=1.5,width=NULL,varwidth=FALSE,notch=FALSE,outline=TRUE,names,
+ xlim=NA,ylim=NA,plot=TRUE,border=par("fg"),col=NULL,log="",
+ axis.labels=NULL,axes=TRUE,pars=list(boxwex=0.8,staplewex=0.5,outwex=0.5), 
+ horizontal=FALSE,add=FALSE,at=NULL,main=NULL) {
+
+ if(!is.na(gap$top[1]))
+  if(gap$top[1] > gap$top[2]) gap$top<-rev(gap$top)
+ if(!is.na(gap$bottom[1]))
+  if(gap$bottom[1] > gap$bottom[2]) gap$bottom<-rev(gap$bottom)
+ if(is.na(ylim[1])) {
+  bxpt<-boxplot(x,...,range=range,plot=FALSE)
+  ylim<-range(c(bxpt$stats,bxpt$out))
+ }
+ else bxpt<-boxplot(x,...,ylim=ylim,range=range,plot=FALSE)
+ bxgap<-bxpt
+ if(!is.na(gap$top[1])) {
+  bxgap$stats[bxgap$stats > gap$top[1] & bxgap$stats < gap$top[2]]<-NA
+  if(any(is.na(bxgap$stats))) 
+   stop("gap cannot include the median, interquartiles or the staples")
+  topdiff<-diff(gap$top)
+  bxgap$stats[bxgap$stats > gap$top[2]]<-
+   bxgap$stats[bxgap$stats > gap$top[2]]-topdiff
+  intopgap<-bxgap$out > gap$top[1] & bxgap$out < gap$top[2]
+  bxgap$out[intopgap]<-NA
+  abovetop<-which(bxgap$out > gap$top[2])
+  bxgap$out[abovetop]<-bxgap$out[abovetop]-topdiff
+  rangetop<-gap$top[1]
+  ylim[2]<-ylim[2]-topdiff
+ }
+ else rangetop<-ylim[2]
+ if(!is.na(gap$bottom[1])) {
+  bxgap$stats[bxgap$stats > gap$bottom[1] & bxgap$stats < gap$bottom[2]]<-NA
+  if(any(is.na(bxgap$stats))) 
+   stop("gap cannot include the median, interquartiles or the staples")
+  bottomdiff<-diff(gap$bottom)
+  bxgap$stats[bxgap$stats < gap$bottom[1]]<-
+   bxgap$stats[bxgap$stats < gap$bottom[1]]+bottomdiff
+  bxgap$out[bxgap$out > gap$bottom[1] & bxgap$out < gap$bottom[2]] <- NA
+  belowbottom<-which(bxgap$out < gap$bottom[1])
+  bxgap$out[belowbottom]<-bxgap$out[belowbottom]+bottomdiff
+  rangebottom<-gap$bottom[2]
+  ylim[1]<-ylim[1]+bottomdiff
+ }
+ else rangebottom<-ylim[1]
+ if(any(is.na(bxgap$out))) 
+  warning("At least one outlier falls into a gap")
+ nboxes<-dim(bxgap$stats)[2]
+ if(is.na(xlim[1])) {
+  xlim<-c(0.5,nboxes+0.5)
+  at<-1:nboxes
+ }
+ bxgap$group<-at
+ plot(0,xlim=xlim,ylim=ylim,type="n",axes=FALSE,xlab="",ylab="",main=main)
+ plotlim<-par("usr")
+ box()
+ if(axes) axis(1,labels=bxpt$names,at=at)
+ midticks<-pretty(c(rangebottom,rangetop))
+ if(axes) axis(2,at=midticks[midticks > rangebottom & midticks < rangetop])
+ if(is.null(width)) width<-pars$boxwex
+ rect(at-width/2,bxgap$stats[2,],at+width/2, 
+  bxgap$stats[4,],border=border,col=col)
+ if(notch) {
+  ymult<-getYmult()
+  if(is.null(col)) boxcol<-"white"
+  else boxcol<-col
+  rect(at-width/1.95,bxgap$conf[1,],at+width/1.95,
+   bxgap$conf[2,],border=NA,col=boxcol)
+  insets<-(bxgap$conf[2,]-bxgap$conf[1,])*pars$boxwex/ymult
+  median.left<-((at-width/2)+insets)
+  median.right<-((at+width/2)-insets)
+  # display the notches
+  segments(at-width/2,bxgap$conf[1,],median.left,bxgap$stats[3,],col=border)
+  segments(at-width/2,bxgap$conf[2,],median.left,bxgap$stats[3,],col=border)
+  segments(median.right,bxgap$stats[3,],at+width/2,bxgap$conf[1,],col=border)
+  segments(median.right,bxgap$stats[3,],at+width/2,bxgap$conf[2,],col=border)
+ }
+ else {
+  median.left<-at-width/2
+  median.right<-at+width/2
+ }
+ # draw the median line
+ segments(median.left,bxgap$stats[3,],median.right,bxgap$stats[3,],
+  lwd=2,col=border)
+ segments(at,bxgap$stats[1,],at,bxgap$stats[2,],lty=2,col=border)
+ segments(at,bxgap$stats[4,],at,bxgap$stats[5,],lty=2,col=border)
+ segments(at-pars$staplewex*width/2,bxgap$stats[1,],
+  at+pars$staplewex*width/2,bxgap$stats[1,],col = border)
+ segments(at-pars$staplewex*width/2,bxgap$stats[5,],
+  at+pars$staplewex*width/2,bxgap$stats[5,],col=border)
+ if(!is.na(gap$top[1])) topadjust<-diff(gap$top)
+ else topadjust<-0
+ if(!is.na(gap$bottom[1])) bottomadjust<-diff(gap$bottom)
+ else bottomadjust<-0
+ if(!is.null(axis.labels)) axis(2,labels=axis.labels,
+  at=c(axis.labels[1]+bottomadjust,axis.labels[2]-topadjust))
+ if(!is.na(gap$top[1])) axis.break(2,gap$top[1],style="gap")
+ if(!is.na(gap$bottom[1]))
+  axis.break(2,gap$bottom[2]-diff(plotlim[3:4])*0.02,style="gap")
+ if(length(bxgap$group) == length(bxgap$out)) points(bxgap$group,bxgap$out)
+ invisible(bxgap)
+}
diff --git a/R/gap.plot.R b/R/gap.plot.R
new file mode 100755
index 0000000..30729a9
--- /dev/null
+++ b/R/gap.plot.R
@@ -0,0 +1,160 @@
+# Try to rewrite this for an arbitrary number of gaps
+
+gap.plot<-function(x,y,gap,gap.axis="y",bgcol="white",breakcol="black",
+ brw=0.02,xlim=range(x),ylim=range(y),xticlab,xtics=NA,yticlab,ytics=NA,
+ lty=rep(1,length(x)),col=rep(par("col"),length(x)),pch=rep(1,length(x)),
+ add=FALSE,stax=FALSE,...) {
+
+ if(missing(y) && !missing(x)) {
+  y<-x
+  x<-1:length(y)
+ }
+ if(missing(gap)) stop("gap must be specified")
+ gapsize<-diff(gap)
+ xaxl<-par("xlog")
+ yaxl<-par("ylog")
+ if(gap.axis == "y") {
+  if(length(gap) > 3) ylim[2]<-ylim[2] - (gapsize[1] + gapsize[3])
+  else ylim[2]<-ylim[2]-gapsize[1]
+ }
+ if(gap.axis == "x") {
+  if(length(gap) > 3) xlim[2]<-xlim[2] - (gapsize[1] + gapsize[3])
+  else xlim[2]<-xlim[2]-gapsize[1]
+ }
+ rangexy <- c(range(xlim),range(ylim))
+ xgw<-(rangexy[2]-(rangexy[1]+gapsize))*brw
+ ygw<-(rangexy[4]-(rangexy[3]+gapsize))*brw
+ if(is.na(xtics[1])) xtics<-pretty(x)
+ if(is.na(ytics[1])) ytics<-pretty(y)
+ if(missing(xticlab)) xticlab<-xtics
+ if(missing(yticlab)) yticlab<-ytics
+ if(length(col) < length(y)) col<-rep(col,length.out=length(y))
+ if(gap.axis == "y") {
+  littleones<-which(y < gap[1])
+  if(length(gap) > 3) {
+   middleones<-which(y >= gap[2] + ygw & y < gap[3])
+   bigones<-which(y >= gap[4] + ygw)
+   lostones<-sum(c(y > gap[1] & y < gap[2] + ygw,y > gap[3] & y < gap[4] + ygw))
+  }
+  else {
+   middleones<-NA
+   bigones<-which(y >= gap[2] + ygw)
+   lostones<-sum(y > gap[1] & y < gap[2] + ygw)
+  }
+  if(lostones) warning("some values of y may not be displayed")
+ }
+ else {
+  littleones<-which(x < gap[1])
+  if(length(gap) > 3) {
+   middleones<-which(x >= gap[2] + xgw & x < gap[3])
+   bigones<-which(x >= gap[4] + xgw)
+   lostones<-sum(c(x > gap[1] & x < gap[2] + xgw,x > gap[3] & x < gap[4] + xgw))
+   if(missing(xlim)) xlim<-c(min(x),max(x) - (gapsize[1] + gapsize[3]))
+  }
+  else {
+   middleones<-NA
+   bigones<-which(x >= gap[2])
+   lostones<-sum(x > gap[1] & x < gap[2] + xgw)
+   if(missing(xlim)) xlim<-c(min(x),max(x) - gapsize[1])
+  }
+  if(lostones) warning("some values of x will not be displayed")
+  if(missing(ylim)) ylim<-range(y)
+ }
+ if(length(lty) < length(x)) lty<-rep(lty,length.out=length(x))
+ if(length(col) < length(x)) col<-rep(col,length.out=length(x))
+ if(length(pch) < length(x)) pch<-rep(pch,length.out=length(x))
+ if(add) {
+  points(x[littleones],y[littleones],lty=lty[littleones],
+   col=col[littleones],pch=pch[littleones],...)
+  if(gap.axis == "y") {
+   if(length(gapsize) > 2) {
+    points(x[middleones],y[middleones]-gapsize[1],
+     lty=lty[middleones],col=col[middleones],pch=pch[middleones],...)
+    points(x[bigones],y[bigones] - (gapsize[1] + gapsize[3]),
+     lty=lty[bigones],col=col[bigones],pch=pch[bigones],...)
+   }
+   else points(x[bigones],y[bigones]-gapsize[1],
+    lty=lty[bigones],col=col[bigones],pch=pch[bigones],...)
+  }
+  else {
+   if(length(gapsize) > 2) {
+    points(x[middleones] - gapsize[1],y[middleones],
+     lty=lty[middleones],col=col[middleones],pch=pch[middleones],...)
+    points(x[bigones] - (gapsize[1] + gapsize[3]),y[bigones],
+     lty=lty[bigones],col=col[bigones],pch=pch[bigones],...)
+   }
+   else points(x[bigones]-gapsize[1],y[bigones],
+    lty=lty[bigones],col=col[bigones],pch=pch[bigones],...)
+  }
+ }
+ else {
+  plot(x[littleones],y[littleones],xlim=xlim,ylim=ylim,axes=FALSE,
+   lty=lty[littleones],col=col[littleones],pch=pch[littleones],...)
+  box()
+  if(gap.axis == "y") {
+   if(!is.na(xtics[1])) axis(1,at=xtics,labels=xticlab)
+   littletics<-which(ytics < gap[1])
+   if(length(gapsize) > 2) {
+    middletics<-which(ytics >= gap[2]+ygw & ytics <= gap[3])
+    bigtics<-which(ytics >= gap[4]+ygw)
+    show.at<-c(ytics[littletics],ytics[middletics] - gapsize[1],
+     ytics[bigtics]-(gapsize[1] + gapsize[3]))
+    show.labels<-c(yticlab[littletics],yticlab[middletics],yticlab[bigtics])
+   }
+   else {
+    bigtics<-which(ytics >= gap[2])
+    show.at<-c(ytics[littletics],ytics[bigtics] - gapsize[1])
+    show.labels<-c(ytics[littletics],yticlab[bigtics])
+   }
+   if(stax) {
+    axis(2,at=show.at,labels=rep("",length(show.labels)))
+    staxlab(2,at=show.at,labels=show.labels)
+   }
+   else axis(2,at=show.at,labels=show.labels)
+   axis.break(2,gap[1],style="gap",bgcol=bgcol,
+    breakcol=breakcol,brw=brw)
+   if(length(gapsize) > 2) {
+    axis.break(2,gap[3]-gapsize[1],style="gap",bgcol=bgcol,
+     breakcol=breakcol,brw=brw)
+    points(x[middleones],y[middleones]-gapsize[1],
+     lty=lty[middleones],col=col[middleones],pch=pch[middleones],...)
+    points(x[bigones],y[bigones]-(gapsize[1]+gapsize[3]),
+     lty=lty[bigones],col=col[bigones],pch=pch[bigones],...)
+   }
+   else points(x[bigones],y[bigones]-gapsize[1],
+    lty=lty[bigones],col=col[bigones],pch=pch[bigones],...)
+  }
+  # x gaps need to be fixed
+  else {
+   if(!is.na(ytics[1])) axis(2,at=ytics,labels=yticlab)
+   littletics<-which(xtics < gap[1])
+   if(length(gapsize) > 2) {
+    middletics<-which(xtics >= gap[2] + xgw & xtics <= gap[3])
+    bigtics<-which(xtics > gap[4]+xgw)
+    show.at<-c(xtics[littletics],xtics[middletics]-gapsize[1],
+     xtics[bigtics]-(gapsize[1]+gapsize[3]))
+    show.labels<-c(xticlab[littletics],xticlab[middletics],xticlab[bigtics])
+   }
+   else {
+    bigtics<-which(xtics > gap[2]+xgw)
+    show.at<-c(xtics[littletics],xtics[bigtics]-gapsize[1])
+    show.labels<-c(xticlab[littletics],xticlab[bigtics])
+   }
+   if(stax) {
+    axis(1,at=show.at,labels=rep("",length(show.labels)))
+    staxlab(1,at=show.at,labels=show.labels)
+   }
+   else axis(1,at=show.at,labels=show.labels)
+   axis.break(1,gap[1],style="gap")
+   if(length(gapsize) > 2) {
+    axis.break(1,gap[3]-gapsize[1],style="gap")
+    points(x[middleones]-gapsize[1],y[middleones],
+     lty=lty[middleones],col=col[middleones],pch=pch[middleones],...)
+    points(x[bigones]-(gapsize[1]+gapsize[3]),y[bigones],
+     lty=lty[bigones],col=col[bigones],pch=pch[bigones],...)
+   }
+   else points(x[bigones]-gapsize[1],y[bigones],
+    lty=lty[bigones],col=col[bigones],pch=pch[bigones],...)
+  }
+ }
+}
diff --git a/R/get.tablepos.R b/R/get.tablepos.R
new file mode 100644
index 0000000..9146bf6
--- /dev/null
+++ b/R/get.tablepos.R
@@ -0,0 +1,60 @@
+get.tablepos<-function(x) {
+ plotlim<-par("usr")
+ tablepos<-list()
+ if(x == "bottomleft") {
+  tablepos$x<-plotlim[1]
+  tablepos$y<-plotlim[3]
+  tablepos$xjust<-0
+  tablepos$yjust<-1
+ }
+ if(x == "bottom") {
+  tablepos$x<-(plotlim[2]+plotlim[1])/2
+  tablepos$y<-plotlim[3]
+  tablepos$xjust<-0.5
+  tablepos$yjust<-1
+ }
+ if(x == "bottomright") {
+  tablepos$x<-plotlim[2]
+  tablepos$y<-plotlim[3]
+  tablepos$xjust<-1
+  tablepos$yjust<-1
+ }
+ if(x == "left") {
+  tablepos$x<-plotlim[1]
+  tablepos$y<-(plotlim[3]+plotlim[4])/2
+  tablepos$xjust<-0
+  tablepos$yjust<-0.5
+ }
+ if(x == "right") {
+  tablepos$x<-plotlim[2]
+  tablepos$y<-(plotlim[3]+plotlim[4])/2
+  tablepos$xjust<-1
+  tablepos$yjust<-0.5
+ }
+ if(x == "topleft") {
+  tablepos$x<-plotlim[1]
+  tablepos$y<-plotlim[4]
+  tablepos$xjust<-0
+  tablepos$yjust<-0
+ }
+ if(x == "top") {
+  tablepos$x<-(plotlim[2]+plotlim[1])/2
+  tablepos$y<-plotlim[4]
+  tablepos$xjust<-0.5
+  tablepos$yjust<-0
+ }
+ if(x == "topright") {
+  tablepos$x<-plotlim[2]
+  tablepos$y<-plotlim[4]
+  tablepos$xjust<-1
+  tablepos$yjust<-0
+ }
+ # if no recognizable position was passed, put it in the center
+ if(x == "center" || length(tablepos)==0) {
+  tablepos$x<-(plotlim[1]+plotlim[2])/2
+  tablepos$y<-(plotlim[3]+plotlim[4])/2
+  tablepos$xjust<-0.5
+  tablepos$yjust<-0.5
+ }
+ return(tablepos)
+}
diff --git a/R/getFigCtr.R b/R/getFigCtr.R
new file mode 100755
index 0000000..891e018
--- /dev/null
+++ b/R/getFigCtr.R
@@ -0,0 +1,12 @@
+getFigCtr<-function(pos=c(0.5,0.5)) {
+ pars<-par(c("usr","mar","fin","pin"))
+ pxspan<-diff(pars$usr[1:2])
+ fxspan<-pxspan*pars$fin[1]/pars$pin[1]
+ figxctr<-
+  pars$usr[1]-(fxspan-pxspan)*pars$mar[2]/(pars$mar[2]+pars$mar[4]) + fxspan*pos[1]
+ pyspan<-diff(pars$usr[3:4])
+ fyspan<-pyspan*pars$fin[2]/pars$pin[2]
+ figyctr<-
+  pars$usr[1]-(fyspan-pyspan)*pars$mar[1]/(pars$mar[1]+pars$mar[3]) + fyspan*pos[2]
+ return(c(figxctr,figyctr))
+}
diff --git a/R/getIntersectList.R b/R/getIntersectList.R
new file mode 100755
index 0000000..25d1244
--- /dev/null
+++ b/R/getIntersectList.R
@@ -0,0 +1,31 @@
+getIntersectList<-function(nelem,xnames=NULL,sep="+") {
+if(is.null(xnames)) xnames<-LETTERS[1:nelem]
+xnamelen<-length(xnames)
+if(xnamelen < nelem) {
+  extranames<-paste("extra",1:(nelem-xnamelen),sep=sep)
+  cat("Not enough names in",xnames,"adding",extranames,"\n")
+  xnames<-c(xnames,extranames)
+}
+intersectList<-vector("list",nelem+2)
+total_n<-0
+for(comb in 1:nelem) {
+  nn<-choose(nelem,comb)
+  intersectList[[comb]]<-rep(0,nn)
+  currentnames<-names(intersectList[[comb]])<-
+   pasteCols(combn(xnames,comb),sep=sep)
+  for(intersect in 1:nn) {
+   cat("Number of elements in",currentnames[intersect],"- ")
+   current_n<-scan(nmax=1,quiet=TRUE)
+   intersectList[[comb]][intersect]<-current_n
+   total_n<-total_n+current_n
+  }
+}
+cat("Total number of elements (press Enter for ",total_n,") - ",
+  sep="")
+intersectList[[nelem + 1]]<-scan(nmax=1,quiet=TRUE)
+if(length(intersectList[[nelem+1]])==0)
+  intersectList[[nelem+1]]<-total_n
+intersectList[[nelem+2]]<-xnames
+class(intersectList) <- "intersectList"
+return(intersectList)
+}
diff --git a/R/getMarginWidth.R b/R/getMarginWidth.R
new file mode 100755
index 0000000..4cf4c62
--- /dev/null
+++ b/R/getMarginWidth.R
@@ -0,0 +1,22 @@
+getMarginWidth<-function(side=4,labels,is.legend=FALSE) {
+ currentmar<-par("mar")
+ currentpin<-par("pin")[1]
+ currentfin<-par("fin")[1]
+ currentusr<-par("usr")
+ if(is.legend) marwidth<-1.2*legend(0,0,labels,fill=NA,plot=FALSE)$rect$w
+ else marwidth<-1.1*max(strwidth(labels))
+ marprop<-ifelse(side==2,currentmar[2]/(currentmar[2]+currentmar[4]),
+  currentmar[4]/(currentmar[2]+currentmar[4]))*(currentfin-currentpin)/currentfin
+ plotprop<-currentpin/currentfin
+ plotwidth<-currentusr[2]-currentusr[1]
+ marusr<-(marprop/plotprop)*plotwidth
+ newmar<-ifelse(side==2,currentmar[2],currentmar[4])*marwidth/marusr
+ cat("plotprop",plotprop,"marprop",marprop,"plotwidth",
+  plotwidth,"marwidth",marwidth,"\n")
+ marcenter<-currentusr[2]+marwidth/2
+ if(marwidth>plotwidth) {
+  warning("figure size too small for new margin!")
+  newmar<-ifelse(side==2,currentmar[2],currentmar[4])
+ }
+ return(list(newmar=newmar,marcenter=marcenter))
+}
diff --git a/R/getYmult.R b/R/getYmult.R
new file mode 100644
index 0000000..0603a0b
--- /dev/null
+++ b/R/getYmult.R
@@ -0,0 +1,14 @@
+getYmult<-function() {
+ if(dev.cur() == 1) {
+  warning("No graphics device open.")
+  ymult<-1
+ }
+ else {
+  # get the plot aspect ratio
+  xyasp<-par("pin")
+  # get the plot coordinate ratio
+  xycr<-diff(par("usr"))[c(1,3)]
+  ymult<-xyasp[1]/xyasp[2]*xycr[2]/xycr[1]
+ }
+ return(ymult)
+}
diff --git a/R/gradient.rect.R b/R/gradient.rect.R
new file mode 100755
index 0000000..4578d8f
--- /dev/null
+++ b/R/gradient.rect.R
@@ -0,0 +1,33 @@
+gradient.rect<-function(xleft,ybottom,xright,ytop,reds,greens,blues, 
+ col=NULL,nslices=50,gradient="x",border=par("fg")) {
+
+ if(is.null(col)) col<-color.gradient(reds, greens, blues, nslices)
+ else nslices<-length(col)
+ nrect<-max(unlist(lapply(list(xleft,ybottom,xright,ytop),length)))
+ if(nrect > 1) {
+  if(length(xleft) < nrect) xleft<-rep(xleft,length.out=nrect)
+  if(length(ybottom) < nrect) ybottom<-rep(ybottom,length.out=nrect)
+  if(length(xright) < nrect) xright<-rep(xright,length.out=nrect)
+  if(length(ytop) < nrect) ytop<-rep(ytop,length.out=nrect)
+  for(i in 1:nrect)
+   gradient.rect(xleft[i],ybottom[i],xright[i],ytop[i],
+    reds,greens,blues,col,nslices,gradient,border=border)
+ }
+ else {
+  if (gradient == "x") {
+   xinc <- (xright - xleft)/nslices
+   xlefts <- seq(xleft, xright - xinc, length = nslices)
+   xrights <- xlefts + xinc
+   rect(xlefts,ybottom,xrights,ytop,col=col,lty=0)
+   rect(xlefts[1],ybottom,xrights[nslices],ytop,border=border)
+  }
+  else {
+   yinc <- (ytop - ybottom)/nslices
+   ybottoms <- seq(ybottom, ytop - yinc, length = nslices)
+   ytops <- ybottoms + yinc
+   rect(xleft,ybottoms,xright,ytops,col=col,lty=0)
+   rect(xleft,ybottoms[1],xright,ytops[nslices],border=border)
+  }
+ }
+ invisible(col)
+}
diff --git a/R/histStack.R b/R/histStack.R
new file mode 100644
index 0000000..ee22222
--- /dev/null
+++ b/R/histStack.R
@@ -0,0 +1,37 @@
+histStack<-function(x,...) {
+ UseMethod("histStack")
+}
+
+histStack.formula<-function(x,data,breaks="Sturges",col="rainbow",right=TRUE,
+ main="",xlab=NULL,legend.pos=NULL,cex.legend=0.75,...) {
+
+ mf<-model.frame(x,data=data)
+ if(is.null(xlab)) xlab<-names(mf)[1]
+ histStack.default(mf[,1],mf[,2],breaks=breaks,col=col,right=right,
+  main=main,xlab=xlab,legend.pos=legend.pos,cex.legend=cex.legend,...)
+}
+
+histStack.default<-function(x,z,breaks="Sturges",col="rainbow",right=TRUE,
+ main="",xlab=NULL,legend.pos=NULL,cex.legend=0.75,...) {
+
+ if(!is.factor(z)) {
+  z<-factor(z)
+  warning("z was converted to a factor")
+ }
+ seps=levels(z)
+ numseps<-length(seps)
+ if(length(col) == 1) col<-do.call(col,list(n=numseps))
+ if(length(col) < numseps) col<-rep(col,length.out=numseps)
+ if(!is.numeric(x)) stop("x must be numeric",call.=FALSE)
+ # plot the histogram of all x
+ hS<-hist(x,breaks=breaks,col=col[1],right=right,main=main,xlab=xlab,...)
+ # plot the remaining 
+ for(i in 1:(numseps-1))
+  hist(x[z %in% seps[-(1:i)]],breaks=hS$breaks,col=col[i+1],
+  right=right,add=TRUE)
+ if(!is.null(legend.pos)) {
+  if(length(legend.pos > 1))
+   legend(legend.pos[1],legend.pos[2],seps,fill=col,cex=cex.legend)
+  else legend(legend.pos,seps,fill=col,cex=cex.legend)
+ }
+}
diff --git a/R/intersectDiagram.R b/R/intersectDiagram.R
new file mode 100644
index 0000000..bd1fca7
--- /dev/null
+++ b/R/intersectDiagram.R
@@ -0,0 +1,138 @@
+intersectDiagram<-function(x,pct=FALSE,show.nulls=FALSE,xnames=NULL, 
+ sep="+",mar=c(0,0,3,0),main="Intersection Diagram",cex=1,col=NULL,
+ minspacing=NA,all.intersections=FALSE,include=NULL,
+ null.label="Non-set") {
+
+ matchParts<-function(x,table,ignore.case=TRUE) {
+  for(pattern in 1:length(x)) {
+   match_index<-grep(x[pattern],table,ignore.case=ignore.case)
+   if(length(match_index)) return(match_index)
+  }
+  return(0)
+ }
+ if(!match(class(x),"intersectList",0)) {
+  if(is.matrix(x) || is.data.frame(x)) {
+   if(is.data.frame(x)) 
+    x<-as.matrix(x)
+    x<-makeIntersectList(x,xnames=xnames,sep=sep)
+  }
+  if(!match(class(x),"intersectList",0)) 
+   stop("x must be a matrix, data frame or intersectList")
+ }
+ oldmar<-par("mar")
+ par(mar=mar)
+ # attribute labels
+ attributes<-x[[length(x)]]
+ # get all the names for the individual attributes
+ if(is.null(include)) include<-attributes
+ # total number of attributes
+ nattributes<-length(attributes)
+ # peel off the number of objects and the attributes for display
+ x[[length(x)]]<-NULL
+ nobjects<-x[[length(x)]]
+ x[[length(x)]]<-NULL
+ # number of intersection levels with at least one object
+ nlevels<-length(x)
+ # if no colors specified, use rainbow
+ if(is.null(col)) col<-c(rainbow(nattributes),NA)
+ else
+  if(length(col) < nattributes) col<-rep(col,length.out=nattributes)
+ # total number of objects for each intersection level
+ objectsums<-sapply(x,sum)
+ # index of level with the most objects
+ maxlevel<-which.max(objectsums)
+ nNonZero<-function(x) return(sum(x > 0))
+ # number of intersections with at least one member for each
+ # intersection level or all intersections if the somewhat dangerous
+ # "show everything" option is TRUE
+ if(all.intersections) nintersects<-sapply(x,length)
+ else nintersects<-sapply(x,nNonZero)
+ # maximum number of intersections in a given level
+ maxintersections<-max(nintersects)
+ # largest intersection set in x
+ maxn<-max(unlist(x))
+ # default to a minimum spacing of one tenth of the largest intersection set
+ if(is.na(minspacing)) minspacing<-0.1 * maxn
+ # x limit that will hold the maximum number of objects and allow
+ # spacing for the maximum number of intersections in units of objects 
+ maxx<-ifelse(nobjects > objectsums[maxlevel],
+  nobjects,objectsums[maxlevel] + minspacing * maxintersections)
+ # have to escape the separator in case it is "+" (default) or
+ # some other character that means something to some function
+ attsep<-paste("[",sep,"]",sep="")
+ # display the empty plot
+ plot(0,xlim=c(0,maxx),ylim=c(0,nlevels+show.nulls), 
+  main=main,xlab="",ylab="",type="n",axes=FALSE)
+ # step through each level of intersections
+ for(level in 1:nlevels) {
+  # determine the intersect level by the number of elements in the first name
+  intersectLevel<-length(unlist(strsplit(names(x[[level]][1]),attsep)))
+  # indices of intersections with at least one object in this level
+  # or just all of the intersections
+  if(all.intersections) intersections<-1:nintersects[[level]]
+  else intersections<-which(x[[level]] > 0)
+  # get all the names in this level with at least one object
+  blocknames<-names(x[[level]])[intersections]
+  # spacing between intersection sets in object units
+  spacing<-(maxx - objectsums[level])/nintersects[level]
+  # left edges of the rectangles in x positions
+  leftx<-c(0,cumsum(x[[level]][intersections] + spacing)) + spacing/2
+  # now step through the intersections in this level
+  for(intersect in 1:length(intersections)) {
+   # check if this intersection is to be displayed
+   if(matchParts(include,blocknames[intersect])) {
+    # make the label for the intersection
+    cellqnt<-ifelse(pct,
+     paste(round(100*x[[level]][intersections[intersect]]/nobjects,1),
+     "%",sep=""),x[[level]][intersections[intersect]])
+    # indices of the colors to use for this rectangle
+    colindex<-
+     which(attributes %in% unlist(strsplit(blocknames[intersect],attsep)))
+    # number of colors
+    ncol<-length(colindex)
+    # width of each color slice
+    xinc<-x[[level]][intersections[intersect]]/ncol
+    # colors for the slices
+    slicecol<-col[colindex]
+    # start at the left edge of the sliced rectangle
+    offset<-0
+    # step through the slices
+    for(slice in 1:ncol) {
+     # first draw the rectangle with no border
+     rect(leftx[intersect]+offset,nlevels-level+show.nulls+0.1,
+      leftx[intersect]+offset+xinc,nlevels-level+show.nulls+0.9,
+      col=slicecol[slice],border=NA)
+     # move to the left edge of the next slice
+     offset<-offset+xinc
+    }
+    # draw a box around the sliced rectangle
+    rect(leftx[intersect],nlevels-level+show.nulls+0.1,
+     leftx[intersect]+x[[level]][intersections[intersect]], 
+     nlevels-level+show.nulls+0.9)
+    # display the label for this rectangle
+    boxed.labels(leftx[intersect]+x[[level]][intersections[intersect]]/2, 
+     nlevels-level+show.nulls+0.5,
+     paste(blocknames[intersect],cellqnt,sep="\n"),cex=cex)
+   }
+  }
+ }
+ if(show.nulls) {
+  # number of objects with no set membership or no attributes
+  nonset<-as.numeric(nobjects - sum(objectsums))
+  # left edge of the rectangle
+  leftnulls<-sum(par("usr")[1:2])/2-nonset/2
+  # draw the rectangle
+  if(nonset) rect(leftnulls,0.1,leftnulls+nonset,0.9)
+  # center of the rectangle
+  xpos<-leftnulls+nonset/2
+  # display the label
+  if(pct) nonset<-paste(round(100*nonset/nobjects,1),"%",sep="")
+  boxed.labels(xpos,0.5,paste(null.label,nonset,sep="\n"),cex=cex)
+ }
+ # restore the original plot parameters
+ par(mar=oldmar)
+ # stick the number of objects and attributes back on
+ x[[length(x) + 1]]<-nobjects
+ x[[length(x) + 1]]<-attributes
+ invisible(x)
+}
diff --git a/R/kiteChart.R b/R/kiteChart.R
new file mode 100755
index 0000000..32c046d
--- /dev/null
+++ b/R/kiteChart.R
@@ -0,0 +1,87 @@
+kiteChart<-function(x,xlim=NA,ylim=NA,timex=TRUE,main="Kite chart",
+ xlab=ifelse(timex,"Time","Groups"),ylab=ifelse(timex,"Groups","Time"),
+ border=par("fg"),col=NULL,varpos=NA,varlabels=NA,varscale=FALSE,
+ timepos=NA,timelabels=NA,mar=c(5,4,4,4),axlab=c(1,2,3,4),
+ normalize=FALSE,shownorm=TRUE,...) {
+
+ # leave a bit more space on top if there is an axis
+ if(varscale || normalize) mar<-mar+c(0,0,!timex,timex)
+ dimx<-dim(x)
+ if(normalize) {
+  if(is.na(varpos[1])) varpos<-1:dimx[2]
+  kitewidths<-rep(1,dimx[2])
+  kitemax<-1
+ }
+ else {
+  if(is.na(varpos[1])) {
+   kitewidths<-apply(as.matrix(x),1,max,na.rm=TRUE)
+   varpos<-rep(0,length(kitewidths)-1)
+   varpos[1]<-1.1*kitewidths[1]/2
+   for(kite in 2:length(kitewidths))
+    varpos[kite]<-varpos[kite-1]+1.1*(kitewidths[kite-1]+kitewidths[kite])/2
+   kitemax<-1.1*sum(kitewidths)
+  }
+  else {
+   kitemax<-max(diff(varpos))
+   kitewidths<-apply(as.matrix(x),1,max,na.rm=TRUE)
+  }
+ }
+ oldmar<-par(mar=mar)
+ if(is.na(xlim[1])) {
+  if(timex) xlim<-c(1,dimx[2])
+  else {
+   if(normalize) xlim<-c(0.5,dimx[1]+0.5)
+   else xlim<-c(0,kitemax)
+  }
+ }
+ if(is.na(ylim[1])) {
+  if(timex) {
+   if(normalize) ylim<-c(0.5,dimx[1]+0.5)
+   else ylim<-c(0,kitemax)
+  }
+  else ylim<-c(1,dimx[2])
+ }
+ plot(0,xlim=xlim,ylim=ylim,main=main,xlab=xlab,ylab=ylab,type="n",
+  axes=FALSE,...)
+ if(is.na(varpos[1])) varpos<-1:dimx[1]
+ if(is.na(varlabels[1])) {
+  if(is.null(rownames(x))) varlabels<-varpos[1:dimx[1]]
+  else varlabels<-rownames(x)
+ }
+ axis(ifelse(timex,axlab[2],axlab[1]),at=varpos[1:dimx[1]],labels=varlabels)
+ if(is.na(timepos[1])) timepos<-1:dimx[2]
+ if(is.na(timelabels[1])) {
+  if(is.null(colnames(x))) timelabels<-timepos
+  else timelabels<-colnames(x)
+ }
+ axis(ifelse(timex,axlab[1],axlab[2]),at=timepos,labels=timelabels)
+ if(varscale && !normalize) {
+  plotlim<-par("usr")
+  mtext(round(kitewidths,1),side=3+timex,at=varpos)
+  axis(3+timex,at=c(varpos-kitewidths/2,varpos+kitewidths/2),
+   labels=rep("",2*length(varpos)))
+ }
+ box()
+ if(is.null(col)) col<-rainbow(dimx[1])
+ if(length(col) < dimx[1]) col<-rep(col,length.out=dimx[1])
+ for(krow in 1:dimx[1]) {
+  if(normalize) {
+   if(shownorm)
+    mtext(paste("*",signif(1/max(x[krow,]),digits=3)),
+     ifelse(timex,axlab[4],axlab[3]),at=varpos[krow],las=1)
+   x[krow,]<-x[krow,]/(max(x[krow,]))
+  }
+  xpos<-1:length(x[krow,])
+  if(timex)
+   polygon(c(xpos,rev(xpos)),
+    c(varpos[krow]+x[krow,]/2,
+    varpos[krow]-rev(x[krow,])/2),
+    col=col[krow],border=border)
+  else
+   polygon(c(varpos[krow]+x[krow,]/2,
+    varpos[krow]-rev(x[krow,])/2),
+    c(xpos,rev(xpos)),
+    col=col[krow],border=border)
+ }
+ invisible(oldmar)
+}
diff --git a/R/labbePlot.R b/R/labbePlot.R
new file mode 100644
index 0000000..36f2a64
--- /dev/null
+++ b/R/labbePlot.R
@@ -0,0 +1,44 @@
+# labbePlot reads a list of comparison trial results between two conditions,
+# typically "placebo" and "intervention" for clinical trials,
+# and plots each result as a circle centered at the percentage of successes
+# for each condition, with radius proportional to the square root of the
+# number of observations (multiplied by "circle.mag" for very small or large
+# numbers of observations), with optional fill colors.
+
+labbePlot<-function(x,main="L'Abbe plot",
+ xlab="Percent positive response with placebo",
+ ylab="Percent positive response with treatment",
+ labels=NULL,col=NA,circle.mag=0.5,add=FALSE,...) {
+
+ if(is.list(x)) {
+  if(!add)
+   plot(0,xlim=c(0,100),ylim=c(0,100),main=main,xlab=xlab,
+    ylab=ylab,type="n",...)
+  for(trial in 1:length(x)) {
+   if(is.matrix(x[[trial]])) {
+    sum_treat<-sum(x[[trial]][1,])
+    sum_interv<-sum(x[[trial]][2,])
+    xpos<-100*x[[trial]][1,1]/sum_treat
+    ypos<-100*x[[trial]][2,1]/sum_interv
+    rad<-circle.mag*sqrt(sum_treat+sum_interv)
+   }
+   else {
+    xpos<-x[[trial]][1]
+    ypos<-x[[trial]][2]
+    rad<-circle.mag*sqrt(x[[trial]][3])
+   }
+   circle.col<-ifelse(is.list(col),col[[trial]],col)
+   draw.circle(xpos,ypos,rad,col=circle.col)
+   if(!is.null(labels[[trial]])) {
+    textcol<-ifelse(colSums(col2rgb(circle.col)*c(1,1.4,0.6)) < 350,
+     "white", "black")
+    text(xpos,ypos,labels[[trial]],col=textcol)
+   }
+  }
+  segments(0,0,100,100)
+ }
+ else {
+  cat("labbePlot: x must be a list of 2x2 tables OR\n")
+  cat("3 element numeric vectors of percent, percent, N (see help page)\n")
+ }
+}
diff --git a/R/ladderplot.R b/R/ladderplot.R
new file mode 100755
index 0000000..7cb38a3
--- /dev/null
+++ b/R/ladderplot.R
@@ -0,0 +1,4 @@
+ladderplot <-
+function (x, ...) 
+    UseMethod("ladderplot")
+
diff --git a/R/ladderplot.default.R b/R/ladderplot.default.R
new file mode 100755
index 0000000..3d122ab
--- /dev/null
+++ b/R/ladderplot.default.R
@@ -0,0 +1,37 @@
+ladderplot.default <-
+function(x, scale=FALSE, col=1, pch=19, lty=1, xlim=c(0.5, ncol(x)+0.5), ylim=range(x), vertical = TRUE, ordered=FALSE, ...)
+{
+    x <- as.data.frame(x)
+    if (scale)
+        x <- apply(x, 2, function(x) (x - min(x, na.rm = TRUE))/(max(x, 
+            na.rm = TRUE) - min(x, na.rm = TRUE)))
+    if (NCOL(x) < 2)
+        stop("'x' must have at least 2 columns")
+    nr <- nrow(x)
+    if (length(col) < nr)
+        col <- rep(col, nr)[1:nr]
+    if (length(pch) < nr)
+        pch <- rep(pch, nr)[1:nr]
+    if (length(lty) < nr)
+        lty <- rep(lty, nr)[1:nr]
+    if (ordered)
+        x <- x[,order(colnames(x))]
+    y <- data.frame(values=array(unlist(x)), 
+        ind=factor(rep(1:ncol(x), each=nrow(x)), labels=colnames(x)))
+
+    id <- match(colnames(x),levels(y$ind))
+    if (vertical) {
+        with(y, stripchart(values ~ ind, pch=pch, ylim=ylim, xlim=xlim, vertical=vertical, col="white", ...))
+        lapply(1:ncol(x), function(i) points(cbind(rep(i,nr), x[,id[i]]), col=col, pch=pch))
+        lapply(1:nr, function(i) lines(cbind(id, as.matrix(x)[i,]), col=col[i], lty=lty[i]))
+    } else {
+        tmp <- xlim
+        xlim <- ylim
+        ylim <- tmp
+        with(y, stripchart(values ~ ind, pch=pch, ylim=ylim, xlim=xlim, vertical=vertical, col="white", ...))
+        lapply(1:ncol(x), function(i) points(cbind(x[,id[i]], rep(i,nr)), col=col, pch=pch))
+        lapply(1:nr, function(i) lines(cbind(as.matrix(x)[i,], id), col=col[i], lty=lty[i]))
+    }
+    invisible(NULL)
+}
+
diff --git a/R/legendg.R b/R/legendg.R
new file mode 100755
index 0000000..a298eb1
--- /dev/null
+++ b/R/legendg.R
@@ -0,0 +1,83 @@
+legendg<-function (x, y = NULL, legend, fill = NULL, col = par("col"), 
+ border = list("black"), lty, lwd, pch = NULL, angle = 45, 
+ density = NULL, bty = "o", bg = par("bg"), box.lwd = par("lwd"), 
+ box.lty = par("lty"), box.col = par("fg"), pt.bg = NA, cex = 1, 
+ pt.cex = cex, pt.lwd = lwd, pt.space = 1, xjust = 0, yjust = 1, 
+ x.intersp = 1, y.intersp = 1, adj = c(0, 0.5), text.width = NULL, 
+ text.col = par("col"), merge = FALSE, trace = FALSE, plot = TRUE, 
+ ncol = 1, horiz = FALSE, title = NULL, inset = 0, xpd, title.col = text.col) {
+ 
+ if (missing(legend) && !is.null(y)) {
+  legend <- y
+  y <- NULL
+ }
+    if (is.list(x)) {
+        y <- x$y
+        x <- x$x
+    }
+    if (is.null(y)) {
+        if (is.character(x)) {
+            tablepos <- get.tablepos(x)
+            x <- tablepos$x
+            y <- tablepos$y
+            xjust <- tablepos$xjust
+            yjust <- tablepos$yjust
+        }
+    }
+    if (!missing(xpd)) {
+        oldxpd <- par("xpd")
+        par(xpd = xpd)
+    }
+    legend.info <- legend(x = x, y = y, legend = legend, col = par("bg"), 
+        lty = 1, bty = bty, bg = bg, box.lwd = box.lwd, box.lty = box.lty, 
+        box.col = par("fg"), pt.bg = NA, cex = cex, pt.cex = pt.cex, 
+        pt.lwd = pt.lwd, xjust = xjust, yjust = yjust, x.intersp = x.intersp, 
+        y.intersp = y.intersp, adj = adj, text.width = text.width, 
+        text.col = text.col, merge = merge, trace = trace, plot = plot, 
+        ncol = ncol, horiz = horiz, title = title, inset = inset, 
+        title.col = title.col)
+    if (!is.null(fill)) {
+        if (length(border) < length(fill)) 
+            border <- rep(border, length(fill))
+        rectheight <- strheight("Q", cex = cex)
+        if (length(adj) > 1) 
+            yadj <- adj[2]
+        else yadj <- 0.5
+        for (nel in 1:length(fill)) {
+            nrect <- length(fill[[nel]])
+            rectspace <- (legend.info$text$x[nel] - legend.info$rect$left)
+            lefts <- cumsum(c(legend.info$rect$left + rectspace * 
+                0.1, rep(0.8 * rectspace/nrect, nrect - 1)))
+            rights <- lefts + 0.7 * rectspace/nrect
+            bottoms <- rep(legend.info$text$y[nel] - yadj * rectheight, 
+                nrect)
+            rect(lefts, bottoms, rights, bottoms + rectheight, 
+                col = fill[[nel]], border = ifelse(is.na(fill[[nel]]), 
+                  NA, border[[nel]]))
+        }
+    }
+    if (!is.null(pch)) {
+        if (!is.list(col)) {
+            mycol <- pch
+            if (length(col) < length(mycol[[1]])) 
+                col <- rep(col, length.out = length(mycol[[1]]))
+            for (nel in 1:length(col)) mycol[[nel]] <- rep(col, 
+                length.out = length(mycol[[nel]]))
+        }
+        else mycol <- col
+        lenpch <- length(pch)
+        xright <- legend.info$text$x[1] - (legend.info$text$x[1] - 
+            legend.info$rect$left) * 0.15
+        for (nel in 1:lenpch) {
+            npch <- length(pch[[nel]])
+            pchwidth <- strwidth(pch[[nel]]) * pt.space
+            xpos <- rev((xright + pchwidth/2) - cumsum(pchwidth))
+            ypos <- rep(legend.info$text$y[nel], npch)
+            points(xpos, ypos, pch = pch[[nel]], col = mycol[[nel]], 
+                cex = pt.cex)
+        }
+    }
+    if (!missing(xpd)) 
+        par(xpd = oldxpd)
+    invisible(legend.info)
+}
diff --git a/R/lengthKey.R b/R/lengthKey.R
new file mode 100755
index 0000000..863ac96
--- /dev/null
+++ b/R/lengthKey.R
@@ -0,0 +1,12 @@
+lengthKey<-function(x,y,tickpos,scale) {
+ par(xpd=TRUE)
+ nticks<-length(tickpos)
+ segments(x,y,x+tickpos[nticks]*scale,y)
+ for(tick in 1:nticks) {
+  segments(x+tickpos[tick]*scale,y,
+   x+tickpos[tick]*scale,y+tickpos[nticks]*scale/20)
+  text(x+tickpos[tick]*scale,y+tickpos[nticks]*scale/15,
+  tickpos[tick],adj=c(0.5,0))
+ }
+ par(xpd=FALSE)
+}
diff --git a/R/makeIntersectList.R b/R/makeIntersectList.R
new file mode 100755
index 0000000..6ec2583
--- /dev/null
+++ b/R/makeIntersectList.R
@@ -0,0 +1,66 @@
+pasteCols<-function(x,sep="") {
+ pastestring<-paste("list(",paste("x","[",1:dim(x)[1],",]",
+  sep="",collapse=","),")",sep="")
+ return(do.call(paste,c(eval(parse(text = pastestring)),sep=sep)))
+}
+
+# converts a two column matrix of object identifiers [,1] and attributes [,2]
+# into a data frame of TRUE/FALSE values where each row is an object and
+# each column is an attribute
+
+categoryReshape<-function(x) {
+ dimx<-dim(x)
+ if(is.null(dimx) || dimx[2]==1)
+  stop("Can only reshape a matrix or data frame with at least two columns")
+ row_values<-sort(unique(x[,1]))
+ column_values<-sort(unique(x[,2]))
+ newx<-
+  as.data.frame(matrix(0,nrow=length(row_values),ncol=length(column_values)))
+ for(row in 1:dimx[1]) {
+  row_index<-which(row_values %in% x[row,1])
+  column_index<-which(column_values %in% x[row,2])
+  newx[row_index,column_index]<-1
+ }
+ names(newx)<-column_values
+ return(newx)
+}
+
+# makes an intersectList object from a matrix or data frame of TRUE/FALSE
+# values where each row represents an object and each column an attribute
+# TRUE indicates that the object has that attribute, FALSE that it does not
+# add a "weight" vector that allows a count of objects to be read directly
+
+makeIntersectList<-function(x,xnames=NULL,sep="+") {
+ # If any entries in x are not 1/0 OR TRUE/FALSE, assume that x
+ # is a two column matrix of object identifiers [,1] and attributes [,2]
+ if(any(!(x %in% c(TRUE,FALSE)))) x<-categoryReshape(x)
+ if(is.null(xnames)) xnames <- colnames(x)
+ dimx<-dim(x)
+ if(is.null(xnames)) xnames<-LETTERS[1:dimx[2]]
+ intersectList<-vector("list",dimx[2]+2)
+ for(intersect in 1:dimx[2])
+  intersectList[[1]][intersect]<-sum(rowSums(x)==1 & x[,intersect])
+ names(intersectList[[1]])<-xnames
+ for(comb in 2:dimx[2]) {
+  nn<-choose(dimx[2],comb)
+  intersectList[[comb]]<-rep(0,nn)
+  currentnames<-
+   names(intersectList[[comb]])<-pasteCols(combn(xnames,comb),sep)
+  currentcombs<-combn(1:dimx[2],comb,simplify=TRUE)
+  for(intersect in 1:nn) {
+   combvec<-rep(0,dimx[2])
+   combvec[currentcombs[,intersect]]<-1
+   intersectList[[comb]][intersect]<-
+    sum(colSums(apply(x,1,"==",combvec))==dimx[2])
+  }
+ }
+ intersectList[[dimx[2]+1]]<-dimx[1]
+ names(intersectList[[dimx[2] + 1]])<-"Total"
+ intersectList[[dimx[2]+2]]<-xnames
+ names(intersectList[[dimx[2] + 2]])<-"attributes"
+ # drop any empty intersection levels
+ for(comb in dimx[2]:1)
+  if(sum(intersectList[[comb]])==0) intersectList[[comb]]<-NULL
+ class(intersectList)<-"intersectList"
+ return(intersectList)
+}
diff --git a/R/maxEmptyRect.R b/R/maxEmptyRect.R
new file mode 100644
index 0000000..4fea521
--- /dev/null
+++ b/R/maxEmptyRect.R
@@ -0,0 +1,61 @@
+# function to find the largest rectangle not containing any of the points
+# specified by x and y
+# adapted by Hans Borchers from 
+# A. Naamad, D. T. Lee, and W.-L. Hsu (1984). On the Maximum Empty
+# Rectangle Problem. Discrete Applied Mathematics, Vol. 8, pp. 267--277.
+
+maxEmptyRect <- function(ax, ay, x, y) {
+ n <- length(x)
+ d <- sort(c(ax, x))
+ D <- diff(d)
+ m <- which.max(D)
+ # check vertical slices
+ mgap <- D[m]
+ maxr <- mgap * (ay[2] - ay[1])
+ maxR <- c(d[m], ay[1], d[m+1], ay[2])
+ o <- order(y)
+ X <- x[o]; Y <- y[o]
+ for (i in 1:n) {
+  tl <- ax[1]; tr <- ax[2]
+  if (i < n) {
+   for (j in (i+1):n) {
+    if (X[j] > tl && X[j] < tr) {
+     # check horizontal slices (j == i+1)
+     # and (all) rectangles above (X[i], Y[i])
+     area <- (tr-tl)*(Y[j]-Y[i])
+     if (area > maxr) {
+      maxr <- area
+      maxR <- c(tl, Y[i], tr, Y[j])
+     }
+     if (X[j] > X[i]) tr <- X[j]
+     else tl <- X[j]
+    }
+   }
+  }
+  # check open rectangles above (X[i], Y[i])
+  area <- (tr-tl)*(ay[2]-Y[i])
+  if (area > maxr) {
+   maxr <- area
+   maxR <- c(tl, Y[i], tr, ay[2])
+  }
+ }
+ for (i in 1:n) {
+  # check open rectangles above (X[i], Y[i])
+  ri <- min(ax[2], X[Y > Y[i] & X > X[i]])
+  li <- max(ax[1], X[Y > Y[i] & X < X[i]])
+  area <- (ri-li)*(ay[2]-Y[i])
+  if (area > maxr) {
+   maxr <- area
+   maxR <- c(li, Y[i], ri, ay[2])
+  }
+  # check open rectangles below (X[i], Y[i])
+  ri <- min(ax[2], X[Y < Y[i] & X > X[i]])
+  li <- max(ax[1], X[Y < Y[i] & X < X[i]])
+  area <- (ri-li)*(Y[i]-ay[1])
+  if (area > maxr) {
+   maxr <- area
+   maxR <- c(li, ay[1], ri, Y[i])
+  }
+ }
+ return(list(area = maxr, rect = maxR))
+}
diff --git a/R/multhist.R b/R/multhist.R
new file mode 100755
index 0000000..3230dd3
--- /dev/null
+++ b/R/multhist.R
@@ -0,0 +1,30 @@
+multhist <- function (x, beside=TRUE, freq=NULL, probability=!freq,
+ plot.it=TRUE, ...) {
+  ## sort out histogram arguments
+  hist.args <- formals(hist.default)
+  args <- list(...)
+  hargs <- names(args)[names(args) %in% names(hist.args)]
+  hist.args[hargs] <- args[hargs]
+  hist.args$plot<-FALSE
+  ## sort out barplot arguments
+  barplot.args <- formals(barplot.default)
+  bargs <- names(args)[names(args) %in% names(barplot.args)]
+  barplot.args[bargs] <- args[bargs]
+  barplot.args$beside <- beside
+  ## prevent warnings
+  barplot.args$"..." <- barplot.args$inside <- NULL
+  allhist <- hist(unlist(x),hist.args$breaks,plot=FALSE)
+  if (!"names.arg" %in% bargs) {
+    barplot.args$names.arg <- signif(allhist$mids, 2)
+  }
+  if (is.null(freq)) {
+   freq<-if(!missing(probability)) !as.logical(probability)
+    else TRUE
+  }
+  if(freq) comp<-"counts"
+  else comp<-"density"
+  combhist <- t(sapply(x,
+   function(z) hist(z,breaks=allhist$breaks,plot=FALSE)[[comp]]))
+  if(plot.it) do.call("barplot", c(list(combhist),barplot.args))
+  invisible(list(allhist,combhist))
+}
diff --git a/R/multsymbolbox.R b/R/multsymbolbox.R
new file mode 100755
index 0000000..b23b295
--- /dev/null
+++ b/R/multsymbolbox.R
@@ -0,0 +1,15 @@
+multsymbolbox<-function(x1,y1,x2,y2,tot,relw=0.8,fg=par("fg"),bg=par("bg"),
+ box=TRUE,debug=FALSE,...) {
+
+ x1 <- rep(x1, length(tot))
+ y1 <- rep(y1, length(tot))
+ x2 <- rep(x2, length(tot))
+ y2 <- rep(y2, length(tot))
+ fg <- rep(fg, length(tot))
+ bg <- rep(bg, length(tot))
+ for (i in 1:length(tot)) {
+  if (tot[i] > 0)
+   symbolbox(x1[i],y1[i],x2[i],y2[i],tot[i],relw=relw,
+    fg=fg[i],bg=bg[i],box=box,debug=debug,...)
+ }
+}
diff --git a/R/p2p_arrows.R b/R/p2p_arrows.R
new file mode 100644
index 0000000..71683e4
--- /dev/null
+++ b/R/p2p_arrows.R
@@ -0,0 +1,5 @@
+p2p_arrows<-function(x1,y1,x2,y2,space=0.05,col=par("fg"),...) {
+ xspace<-(x2-x1)*space
+ yspace<-(y2-y1)*space
+ arrows(x1+xspace,y1+yspace,x2-xspace,y2-yspace,...)
+}
diff --git a/R/panes.R b/R/panes.R
new file mode 100755
index 0000000..75fbfb1
--- /dev/null
+++ b/R/panes.R
@@ -0,0 +1,8 @@
+panes<-function(mat=NULL,widths=rep(1,ncol(mat)),heights=rep(1,nrow(mat)),
+ nrow=2,ncol=2,mar=c(0,0,1.6,0),oma=c(2.5,1,1,1)) {
+
+ oldpar<-par("mar","mfrow","oma")
+ if(is.null(mat)) par(mfrow=c(nrow,ncol),mar=mar,oma=oma)
+ else layout(mat,widths=widths,heights=heights)
+ return(oldpar)
+}
diff --git a/R/paxis3d.R b/R/paxis3d.R
new file mode 100755
index 0000000..66c36b7
--- /dev/null
+++ b/R/paxis3d.R
@@ -0,0 +1,138 @@
+# 'enhanced' persp -- return value has attributes containing
+#  x,y,z ranges
+perspx <- function(x,y,z,...) {
+  if (missing(z)) {
+    if (!missing(x)) {
+      if (is.list(x)) {
+        z <- x$z
+        y <- x$y
+        x <- x$x
+      }
+      else {
+        z <- x
+        x <- seq.int(0, 1, length.out = nrow(z))
+      }
+    }
+    else stop("no 'z' matrix specified")
+  }
+  else if (is.list(x)) {
+    y <- x$y
+    x <- x$x
+  }
+  p <- persp(x,y,z,...)
+  attr(p,"ranges") <- list(x=range(x),y=range(y),z=range(z))
+  p
+}
+  
+psegments3d <- function(x, y = NULL, z = NULL, pmat, ...) {
+  if (is.null(y) && is.null(z)) {
+    z <- x$z
+    y <- x$y
+    x <- x$x
+  }
+  xy <- trans3d(x,y,z,pmat)
+  # translate from 'segments3d' (successive pairs) to
+  #  'segments' (x0,x1,y0,y1) format
+  n <- length(xy$x)
+  x0 <- xy$x[seq(1,n,by=2)]
+  x1 <- xy$x[seq(2,n,by=2)]
+  y0 <- xy$y[seq(1,n,by=2)]
+  y1 <- xy$y[seq(2,n,by=2)]
+  segments(x0=x0,x1=x1,y0=y0,y1=y1,...)
+}
+
+ptext3d <- function(x, y = NULL, z = NULL, texts, pmat, ...) {
+  if (is.null(y) && is.null(z)) {
+    z <- x$z
+    y <- x$y
+    x <- x$x
+  }
+  do.call(text,c(trans3d(x,y,z,pmat),list(label=texts,...)))
+}
+
+if (FALSE) {
+  pp <- persp(x=1:3,y=1:3,z=matrix(1:9,nrow=3),col="gray")
+  ptext3d(2,2,5,"a",pp,col="red")
+}
+
+get_axispos3d <- function(edge,pmat,at,pos=NULL, dist=0) {
+  ranges <- attr(pmat,"ranges")
+  edge <- c(strsplit(edge, "")[[1]], "-", "-")[1:3]
+  coord <- match(toupper(edge[1]), c("X", "Y", "Z"))
+  if (coord == 2) 
+    edge[1] <- edge[2]
+  else if (coord == 3) 
+    edge[1:2] <- edge[2:3]
+  mpos <- matrix(NA, 3, length(at))
+  if (edge[1] == "+") 
+    mpos[1, ] <- ranges$x[2]
+  else mpos[1, ] <- ranges$x[1]
+  if (edge[2] == "+") 
+    mpos[2, ] <- ranges$y[2]
+  else mpos[2, ] <- ranges$y[1]
+  if (edge[3] == "+") 
+    mpos[3, ] <- ranges$z[2]
+  else mpos[3, ] <- ranges$z[1]
+  offset <- dist * (mpos[, 1] - c(mean(ranges$x), mean(ranges$y), 
+                                  mean(ranges$z)))
+  offset[coord] <- 0
+  mpos <- sweep(mpos,1,offset,"+")
+  if (!is.null(pos)) 
+    mpos <- matrix(pos, 3, length(at))
+  mpos[coord, ] <- at
+  mpos
+}
+
+mtext3d <- function (edge, pmat, labels = TRUE, at = NULL, dist=0.3, xpd=NA, ...) {
+  ranges <- attr(pmat,"ranges")
+  edge.orig <- edge # hack
+  edge <- c(strsplit(edge, "")[[1]], "-", "-")[1:3]
+  coord <- match(toupper(edge[1]), c("X", "Y", "Z"))
+  range <- ranges[[coord]]
+  if (is.null(at)) {
+    at <- mean(range)
+  }
+  mpos <- get_axispos3d(edge.orig,pmat,at,dist=dist)
+  ptext3d(mpos[1, ],mpos[2,],mpos[3,],
+          labels, pmat, xpd=xpd, ...)
+}
+
+paxis3d <-
+function (edge, pmat,
+          at = NULL, labels = TRUE, tick = TRUE,
+          pos = NULL, nticks = 5, ticklen=0.05,labdist=0.15,
+          xpd=NA, ...) 
+{
+  ranges <- attr(pmat,"ranges")
+  edge.orig <- edge # hack
+  edge <- c(strsplit(edge, "")[[1]], "-", "-")[1:3]
+  coord <- match(toupper(edge[1]), c("X", "Y", "Z"))
+  range <- ranges[[coord]]
+  if (is.null(at)) {
+    at <- pretty(range, nticks)
+    at <- at[at >= range[1] & at <= range[2]]
+  }
+  if (is.logical(labels)) {
+    if (labels) 
+      labels <- format(at)
+    else labels <- NA
+  }
+  mpos <- get_axispos3d(edge.orig,pmat,at,pos,dist=0)
+  # draw axes
+  x <- c(mpos[1, 1], mpos[1, length(at)])
+  y <- c(mpos[2, 1], mpos[2, length(at)])
+  z <- c(mpos[3, 1], mpos[3, length(at)])
+  psegments3d(x,y,z,pmat, xpd=xpd, ...)
+  if (tick) {
+    mpos_tick <- get_axispos3d(edge.orig,pmat,at,dist=ticklen)
+    x <- c(as.double(rbind(mpos[1, ], mpos_tick[1, ])))
+    y <- c(as.double(rbind(mpos[2, ], mpos_tick[2, ])))
+    z <- c(as.double(rbind(mpos[3, ], mpos_tick[3, ])))
+    psegments3d(x,y,z,pmat, xpd=xpd, ...)
+  }
+  if (!is.null(labels)) {
+    mpos_lab <- get_axispos3d(edge.orig,pmat,at,dist=labdist)
+    ptext3d(mpos_lab[1, ],mpos_lab[2,],mpos_lab[3,],
+            labels, pmat, xpd=xpd, ...)
+  }
+}
diff --git a/R/pie3D.R b/R/pie3D.R
new file mode 100755
index 0000000..69fe8e7
--- /dev/null
+++ b/R/pie3D.R
@@ -0,0 +1,137 @@
+pie3D.labels<-function(radialpos,radius=1,height=0.1,theta=pi/6, 
+ labels,labelcol=par("fg"),labelcex=1.5,labelrad=1.25,minsep=0.3){
+
+ oldcex<-par("cex")
+ nlab<-length(labels)
+ par(cex=labelcex,xpd=TRUE)
+ for (i in 1:nlab) {
+  if(i < nlab) {
+   labelsep<-radialpos[i+1] - radialpos[i]
+   if(labelsep < minsep) {
+    radialpos[i]<-radialpos[i]+(labelsep-minsep)/2
+    radialpos[i+1]<-radialpos[i+1]-(labelsep-minsep)/2
+   }
+  }
+  xpos<-labelrad * radius * cos(radialpos[i])
+  offset<-(radialpos[i] > pi && radialpos[i] < 2 * pi) * height
+  ypos<-labelrad * radius * sin(radialpos[i]) * 2 * theta/pi +
+   sin(radialpos[i]) * height 
+  text(xpos,ypos,labels[i],col=labelcol,
+   adj=c(0.5,abs(0.5-sin(radialpos[i])/2)))
+ }
+ par(cex=oldcex,xpd=FALSE)
+}
+
+draw.tilted.sector<-function(x=0,y=0,edges=NA,radius=1,height=0.1,
+ theta=pi/6,start=0,end=pi*2,border=par("fg"),col=par("bg"),explode=0,
+ shade=0.8) {
+
+ if(is.na(edges)) edges<-trunc(20*(end-start))
+ angleinc<-(end-start)/edges
+ angles<-c(seq(start,end,by=angleinc),end)
+ viscurve<-(angles>=pi)&(angles<=2*pi)
+ nv<-length(angles)
+ bisector<-(start+end)/2
+ if(explode){
+  # calculate the x and y offsets for the explode
+  x<-x+cos(bisector)*explode
+  y<-y+sin(bisector)*(1-sin(theta))*explode
+ }
+ if(shade>0 && shade<1){
+  # calculate the shade color for the sides of the sector
+  rgbcol<-col2rgb(col)
+  shadecol<-rgb(shade*rgbcol[1]/255,shade*rgbcol[2]/255,
+  shade*rgbcol[3]/255)
+ }
+ else shadecol<-col
+ xp<-cos(angles) * radius + x
+ # this is the top of the sector
+ yp<-sin(angles) * 2 * theta/pi * radius + y
+ if(start > 3*pi/2) {
+  # the 'left' side will be visible in this quadrant
+  if(explode > 0)
+   # display the 'right' side just in case it goes beyond pi/2
+   polygon(c(xp[nv],x,x,xp[nv],xp[nv]),c(yp[nv]-height,y-height,
+    y+height,yp[nv]+height,yp[nv]+height),border=border,
+    col=shadecol)
+  # display the 'outside' of the sector
+  polygon(c(xp[viscurve],rev(xp[viscurve])),c(yp[viscurve]-height,
+   rev(yp[viscurve])+height),border=border,col=shadecol)
+  if(explode > 0)
+   # display the 'left' (front) side
+   polygon(c(xp[1],x,x,xp[1],xp[1]),c(yp[1]-height,y-height,
+    y+height,yp[1]+height,yp[1]),border=border,
+    col=shadecol)
+ }
+ else {
+  if(start > pi/2) {
+   if(explode > 0) {
+    polygon(c(xp[1],x,x,xp[1],xp[1]),c(yp[1]-height,y-height,
+     y+height,yp[1]+height,yp[1]),border=border,
+     col=shadecol)
+    polygon(c(xp[nv],x,x,xp[nv],xp[nv]),c(yp[nv]-height,
+     y-height,y+height,yp[nv]+height,yp[nv]+height),
+     border=border,col=shadecol)
+   }
+   if(end > pi)
+    polygon(c(xp[viscurve],rev(xp[viscurve])),c(yp[viscurve]-height,
+     rev(yp[viscurve])+height),border=border,
+     col=shadecol)
+  }
+  else {
+   if(end > pi || start<2*pi)
+    polygon(c(xp[viscurve],rev(xp[viscurve])),c(yp[viscurve]-height,
+     rev(yp[viscurve])+height),border=border,
+     col=shadecol)
+   if(end > pi/2 && end < 3*pi/2 && explode > 0){
+    polygon(c(xp[nv],x,x,xp[nv],xp[nv]),c(yp[nv]-height,
+     y-height,y+height,yp[nv]+height,yp[nv]+height),
+     border=border,col=shadecol)
+   }
+   if(explode > 0)
+    polygon(c(xp[1],x,x,xp[1],xp[1]),c(yp[1]-height,y-height,
+     y+height,yp[1]+height,yp[1]+height),border=border,
+     col=shadecol)
+  }
+ }
+ #display the top
+ polygon(c(xp,x),c(yp+height,y+height),border=border,col=col)
+ return(bisector)
+}
+
+pie3D<-function(x,edges=NA,radius=1,height=0.1,theta=pi/6, 
+ start=0,border=par("fg"),col=NULL,labels=NULL,labelpos=NULL,
+ labelcol=par("fg"),labelcex=1.5,sector.order=NULL,explode=0,
+ shade=0.8,mar=c(4,4,4,4),pty="s",...) {
+
+ if(!is.numeric(x) || any(x < 0)) 
+  stop("pie3D: x values must be positive numbers")
+ # drop NAs
+ if(any(is.na(x))) x<-x[!is.na(x)]
+ oldmar<-par("mar")
+ par(pty=pty,mar=mar,xpd=TRUE)
+ x<-c(0, cumsum(x)/sum(x))*2*pi+start
+ nsectors<-length(x)-1
+ if(is.null(col)) col <- rainbow(nsectors)
+ else if(length(col) < nsectors) col<-rep(col,length.out=nsectors)
+ if(is.null(sector.order))
+  # get the order of drawing sectors
+  sector.order<-
+   order(sin((x[2:(nsectors+1)]+x[1:nsectors])/2),decreasing=TRUE)
+ bc<-rep(0,nsectors)
+ # set up an empty plot
+ plot(0,xlab="",ylab="",xlim=c(-1,1),ylim=c(-1,1),type="n",axes=FALSE,...)
+ for(i in sector.order) {
+  bc[i]<-draw.tilted.sector(radius=radius,height=height, 
+   theta=theta,start=x[i],end=x[i+1],edges=edges, 
+   border=border,col=col[i],explode=explode,shade=shade)
+ }
+ if(!is.null(labels)) {
+  if(!is.null(labelpos)) 
+   bc<-labelpos
+   pie3D.labels(bc,height=height,theta=theta, 
+    labels=labels,labelcol=labelcol,labelcex=labelcex)
+ }
+ par(mar=oldmar,xpd=FALSE,pty="m")
+ invisible(bc)
+}
diff --git a/R/placeLabels.R b/R/placeLabels.R
new file mode 100644
index 0000000..de3be40
--- /dev/null
+++ b/R/placeLabels.R
@@ -0,0 +1,27 @@
+placeLabels<-function(x,y=NA,labels,pointer=TRUE,cex=1,labelcol=par("fg"),
+ labelbg="white",border=par("fg"),pointercol=par("fg"),
+ pch=1,col=1,bg="white",flagcol="red") {
+
+ if(is.na(y) && is.list(x)) {
+  y<-unlist(x[[2]])
+  x<-unlist(x[[1]])
+ }
+ nlabels<-length(labels)
+ if(length(labelcol) < nlabels) labelcol<-rep(labelcol,length.out=nlabels)
+ if(length(labelbg) < nlabels) labelbg<-rep(labelbg,length.out=nlabels)
+ if(length(border) < nlabels) border<-rep(border,length.out=nlabels)
+ if(length(pointercol) < nlabels) pointercol<-rep(pointercol,length.out=nlabels)
+ if(length(pch) < nlabels) pch<-rep(pch,length.out=nlabels)
+ if(length(col) < nlabels) col<-rep(col,length.out=nlabels)
+ if(length(bg) < nlabels) bg<-rep(bg,length.out=nlabels)
+ for(i in 1:nlabels) {
+  points(x[i],y[i],pch=19,col=flagcol)
+  labelxy<-locator(1)
+  if(pointer)
+   segments(x[i],y[i],labelxy$x,labelxy$y,col=pointercol[i])
+  boxed.labels(labelxy$x,labelxy$y,labels[i],
+   col=labelcol[i],bg=labelbg[i],border=border[i])
+  points(rep(x[i],2),rep(y[i],2),pch=c(19,pch[i]),
+   col=c("white",col[i]),bg=c(NA,bg[i]))
+ }
+}
diff --git a/R/plotCI.R b/R/plotCI.R
new file mode 100755
index 0000000..348691b
--- /dev/null
+++ b/R/plotCI.R
@@ -0,0 +1,90 @@
+plotCI <- function (x, y = NULL, uiw, liw = uiw, ui = NULL, li = NULL, 
+    err = "y", sfrac = 0.01, gap = 0, slty = par("lty"), add = FALSE, 
+    scol = NULL, pt.bg = par("bg"), ...) 
+{
+    arglist <- list(...)
+    if (is.list(x)) {
+        y <- x$y
+        x <- x$x
+    }
+    if (is.null(y)) {
+        if (is.null(x)) 
+            stop("both x and y NULL")
+        y <- as.numeric(x)
+        x <- seq(along = x)
+    }
+    if (missing(uiw) && (is.null(ui) || is.null(li))) 
+        stop("must specify either relative limits or both lower and upper limits")
+    if (!missing(uiw)) {
+        if (err == "y") 
+            z <- y
+        else z <- x
+        ui <- z + uiw
+        li <- z - liw
+    }
+    if (is.null(arglist$xlab)) 
+        arglist$xlab <- deparse(substitute(x))
+    if (is.null(arglist$ylab)) 
+        arglist$ylab <- deparse(substitute(y))
+    if (err == "y" && is.null(arglist$ylim)) 
+        arglist$ylim <- range(c(y, ui, li), na.rm = TRUE)
+    if (err == "x" && is.null(arglist$xlim)) 
+        arglist$xlim <- range(c(x, ui, li), na.rm = TRUE)
+    if (missing(scol)) {
+        if (!is.null(arglist$col)) 
+            scol <- arglist$col
+        else scol <- par("col")
+    }
+    plotpoints <- TRUE
+    if (!is.null(arglist$pch) && is.na(arglist$pch)) {
+        arglist$pch <- 1
+        plotpoints <- FALSE
+    }
+    if (!add) 
+        do.call("plot", c(list(x, y, type = "n"), clean.args(arglist, 
+            plot)))
+    if (gap == TRUE) 
+        gap <- 0.01
+    ul <- c(li, ui)
+    pin <- par("pin")
+    usr <- par("usr")
+    x.to.in <- pin[1]/diff(usr[1:2])
+    y.to.in <- pin[2]/diff(usr[3:4])
+    if (err == "y") {
+        gap <- rep(gap, length(x)) * diff(par("usr")[3:4])
+        smidge <- par("fin")[1] * sfrac
+        nz <- abs(li - pmax(y - gap, li)) * y.to.in > 0.001
+        scols <- rep(scol, length.out = length(x))[nz]
+        arrow.args <- c(list(lty = slty, angle = 90, length = smidge, 
+            code = 1, col = scols), clean.args(arglist, arrows, 
+            exclude.other = c("col", "lty", "axes")))
+        do.call("arrows", c(list(x[nz], li[nz], x[nz], pmax(y - 
+            gap, li)[nz]), arrow.args))
+        nz <- abs(ui - pmin(y + gap, ui)) * y.to.in > 0.001
+        scols <- rep(scol, length.out = length(x))[nz]
+        arrow.args$col <- scols
+        do.call("arrows", c(list(x[nz], ui[nz], x[nz], pmin(y + 
+            gap, ui)[nz]), arrow.args))
+    }
+    else if (err == "x") {
+        gap <- rep(gap, length(x)) * diff(par("usr")[1:2])
+        smidge <- par("fin")[2] * sfrac
+        nz <- abs(li - pmax(x - gap, li)) * x.to.in > 0.001
+        scols <- rep(scol, length.out = length(x))[nz]
+        arrow.args <- c(list(lty = slty, angle = 90, length = smidge, 
+            code = 1, col = scols), clean.args(arglist, arrows, 
+            exclude.other = c("col", "lty", "axes")))
+        do.call("arrows", c(list(li[nz], y[nz], pmax(x - gap, 
+            li)[nz], y[nz]), arrow.args))
+        nz <- abs(ui - pmin(x + gap, ui)) * x.to.in > 0.001
+        scols <- rep(scol, length.out = length(x))[nz]
+        arrow.args$col <- scols
+        do.call("arrows", c(list(ui[nz], y[nz], pmin(x + gap, 
+            ui)[nz], y[nz]), arrow.args))
+    }
+    if (plotpoints) 
+        do.call("points", c(list(x, y, bg = pt.bg), clean.args(arglist, 
+            points, exclude.other = c("xlab", "ylab", "xlim", 
+                "ylim", "axes"))))
+    invisible(list(x = x, y = y))
+}
diff --git a/R/plotH.R b/R/plotH.R
new file mode 100644
index 0000000..d3d7f43
--- /dev/null
+++ b/R/plotH.R
@@ -0,0 +1,33 @@
+plotH <- function (x,...) {
+  UseMethod("plotH") 
+}
+
+plotH.formula <- function(x,data=NULL,xlab=names(mf)[2],ylab=names(mf)[1],...) {
+  mf <- model.frame(x,data=data)                               # get model frame
+  if (ncol(mf)>2) stop("Function currently only accepts one variable on RHS of formula")
+  plotH.default(mf[,2],mf[,1],xlab=xlab,ylab=ylab,...)
+}
+
+plotH.default <- function(x,y,xlab=paste(deparse(substitute(x))),ylab=paste(deparse(substitute(y))),width=0.6,ylim=c(0,max(y)),col="gray",...) {
+  plotHq <- function(x,y,xlab,ylab,width,ylim,col,...) {
+    if (is.null(width)) width <- min(diff(x))
+    xleft <- x-width/2
+    xright <- x+width/2
+    ytop <- y
+    if (is.null(ylim)) {
+      ybottom <- min(y[is.finite(y)])
+      ylim <- c(ybottom,max(y[is.finite(y)]))
+    } else ybottom <- min(ylim)
+    plot(x,y,type="n",ylim=ylim,xlab=xlab,ylab=ylab,...)
+    rect(xleft,ybottom,xright,ytop,col=col,...)
+  }  # end plotHq internal function
+
+  plotHc <- function(x,y,xlab,ylab,width,ylim,col,...) {
+    names(y) <- x
+    barplot(y,xlab=xlab,ylab=ylab,width=width,ylim=ylim,col=col,...)
+  }  # end plotHc internal function
+ ## Start of main function
+  if (!is.numeric(y)) stop("Y (or LHS) variable must be quantitative.")
+  if (is.numeric(x)) plotHq(x,y,xlab,ylab,width,ylim,col,...)
+    else plotHc(x,y,xlab,ylab,width,ylim,col,...) 
+}
diff --git a/R/plot_bg.R b/R/plot_bg.R
new file mode 100644
index 0000000..6e6e1c6
--- /dev/null
+++ b/R/plot_bg.R
@@ -0,0 +1,4 @@
+plot_bg<-function(col="lightgray") {
+ plim<-par("usr")
+ rect(plim[1],plim[3],plim[2],plim[4],col=col)
+}
diff --git a/R/polygon.shadow.R b/R/polygon.shadow.R
new file mode 100755
index 0000000..33cdb7a
--- /dev/null
+++ b/R/polygon.shadow.R
@@ -0,0 +1,24 @@
+polygon.shadow<-function(x,y=NULL,offset=NA,inflate=NA,
+ col=c("#ffffff","#cccccc")) {
+ 
+ if(is.null(y)) {
+  if(is.null(x$y)) stop("both x and y coordinates must be given")
+  y<-x$y
+  x<-x$x
+ }
+ xcenter<-mean(x)
+ ycenter<-mean(y)
+ if(is.na(offset[1])) offset<-c((max(x)-min(x))/20,-(max(y)-min(y))/20)
+ if(length(col) == 2) col<-smoothColors(col[1],8,col[2])
+ if(is.na(inflate[1])) {
+  multx<-seq(offset[1],0,length=10)
+  multy<-seq(offset[2],0,length=10)
+ }
+ else {
+  multx<-seq(inflate[1],0,length=10)
+  multy<-seq(inflate[2],0,length=10)
+ }
+ for(i in 1:10)
+  polygon(x+multx[i]*(x-xcenter)+offset[1],y+multy[i]*(y-ycenter)+offset[2],
+   col=col[i],border=NA)
+}
diff --git a/R/pyramid.plot.R b/R/pyramid.plot.R
new file mode 100755
index 0000000..058a03d
--- /dev/null
+++ b/R/pyramid.plot.R
@@ -0,0 +1,122 @@
+pyramid.plot<-function (lx, rx, labels = NA, top.labels = c("Male", "Age", 
+    "Female"), main = "", laxlab = NULL, raxlab = NULL, unit = "%", 
+    lxcol, rxcol, gap = 1, space = 0.2, ppmar = c(4, 2, 4, 2), 
+    labelcex = 1, add = FALSE, xlim, show.values = FALSE, ndig = 1, 
+    do.first = NULL) {
+    
+    if (any(c(lx, rx) < 0, na.rm = TRUE)) 
+        stop("Negative quantities not allowed")
+    lxdim <- dim(lx)
+    rxdim <- dim(rx)
+    ncats <- ifelse(!is.null(lxdim), dim(lx)[1], length(lx))
+    if (length(labels) == 1) 
+        labels <- 1:ncats
+    ldim <- length(dim(labels))
+    nlabels <- ifelse(ldim, length(labels[, 1]), length(labels))
+    if (nlabels != ncats) 
+        stop("lx and labels must all be the same length")
+    if (missing(xlim)) 
+        xlim <- rep(ifelse(!is.null(lxdim), ceiling(max(c(rowSums(lx), 
+            rowSums(rx)), na.rm = TRUE)), ceiling(max(c(lx, rx), 
+            na.rm = TRUE))), 2)
+    if (!is.null(laxlab) && xlim[1] < max(laxlab)) 
+        xlim[1] <- max(laxlab)
+    if (!is.null(raxlab) && xlim[2] < max(raxlab)) 
+        xlim[2] <- max(raxlab)
+    oldmar <- par("mar")
+    if (!add) {
+        par(mar = ppmar, cex.axis = labelcex)
+        plot(0, xlim = c(-(xlim[1] + gap), xlim[2] + gap), ylim = c(0, 
+            ncats + 1), type = "n", axes = FALSE, xlab = "", 
+            ylab = "", xaxs = "i", yaxs = "i", main = main)
+        if (!is.null(do.first)) 
+            eval(parse(text = do.first))
+        if (is.null(laxlab)) {
+            laxlab <- seq(xlim[1] - gap, 0, by = -1)
+            axis(1, at = -xlim[1]:-gap, labels = laxlab)
+        }
+        else axis(1, at = -(laxlab + gap), labels = laxlab)
+        if (is.null(raxlab)) {
+            raxlab <- 0:(xlim[2] - gap)
+            axis(1, at = gap:xlim[2], labels = raxlab)
+        }
+        else axis(1, at = raxlab + gap, labels = raxlab)
+        if (gap > 0) {
+            if (!is.null(lxdim)) 
+                axis(2, at = 1:ncats, labels = rep("", ncats), 
+                  pos = gap, tcl = -0.25)
+            else axis(2, at = 1:ncats * as.logical(rx + 1), labels = rep("", 
+                ncats), pos = gap, tcl = -0.25)
+            if (!is.null(lxdim)) 
+                axis(4, at = 1:ncats, labels = rep("", ncats), 
+                  pos = -gap, tcl = -0.25)
+            else axis(4, at = 1:ncats * as.logical(lx + 1), labels = rep("", 
+                ncats), pos = -gap, tcl = -0.25)
+        }
+        if (is.null(dim(labels))) {
+            if (gap) 
+                text(0, 1:ncats, labels, cex = labelcex)
+            else {
+                text(xlim[1], 1:ncats, labels, cex = labelcex, 
+                  adj = 0)
+                text(xlim[2], 1:ncats, labels, cex = labelcex, 
+                  adj = 1)
+            }
+        }
+        else {
+            if (gap) {
+                lpos <- -gap
+                rpos <- gap
+            }
+            else {
+                lpos <- -xlim[1]
+                rpos <- xlim[2]
+            }
+            text(lpos, 1:ncats, labels[, 1], pos = 4, cex = labelcex, 
+                adj = 0)
+            text(rpos, 1:ncats, labels[, 2], pos = 2, cex = labelcex, 
+                adj = 1)
+        }
+        mtext(top.labels, 3, 0, at = c(-xlim[1]/2, 0, xlim[2]/2), 
+            adj = 0.5, cex = labelcex)
+        mtext(c(unit, unit), 1, 2, at = c(-xlim[1]/2, xlim[2]/2))
+    }
+    halfwidth <- 0.5 - space/2
+    if (is.null(lxdim)) {
+        if (missing(lxcol)) 
+            lxcol <- rainbow(ncats)
+        if (missing(rxcol)) 
+            rxcol <- rainbow(ncats)
+        rect(-(lx + gap), 1:ncats - halfwidth, rep(-gap, ncats), 
+            1:ncats + halfwidth, col = lxcol)
+        rect(rep(gap, ncats), 1:ncats - halfwidth, (rx + gap), 
+            1:ncats + halfwidth, col = rxcol)
+        if (show.values) {
+            par(xpd = TRUE)
+            lxt <- formatC(lx, format = "f", digits = ndig)
+            rxt <- formatC(rx, format = "f", digits = ndig)
+            text(-(gap + lx), 1:ncats, lxt, pos = 2, cex = labelcex)
+            text(gap + rx, 1:ncats, rxt, pos = 4, cex = labelcex)
+            par(xpd = FALSE)
+        }
+    }
+    else {
+        nstack <- dim(lx)[2]
+        if (missing(lxcol)) 
+            lxcol <- rainbow(nstack)
+        if (missing(rxcol)) 
+            rxcol <- rainbow(nstack)
+        lxstart <- rxstart <- rep(gap, ncats)
+        for (i in 1:nstack) {
+            lxcolor <- rep(lxcol[i], ncats)
+            rxcolor <- rep(rxcol[i], ncats)
+            rect(-(lx[, i] + lxstart), 1:ncats - halfwidth, -lxstart, 
+                1:ncats + halfwidth, col = lxcolor)
+            rect(rxstart, 1:ncats - halfwidth, rx[, i] + rxstart, 
+                1:ncats + halfwidth, col = rxcolor)
+            lxstart <- lx[, i] + lxstart
+            rxstart <- rx[, i] + rxstart
+        }
+    }
+    return(oldmar)
+}
diff --git a/R/radial.grid.R b/R/radial.grid.R
new file mode 100644
index 0000000..69771f7
--- /dev/null
+++ b/R/radial.grid.R
@@ -0,0 +1,44 @@
+radial.grid<-function(labels=NA,label.pos=NULL,radlab=FALSE,radial.lim=NULL,
+ start=0,clockwise=FALSE,label.prop=1.1,grid.pos,grid.col="gray",
+ grid.bg="transparent",show.radial.grid=TRUE) {
+
+ par(xpd=TRUE)
+ if(is.null(label.pos)) label.pos<-seq(0,1.8*pi,length=9)
+ if(!is.null(labels)) {
+  if(is.na(labels[1])) labels<-as.character(round(label.pos,2))
+ }
+ if(clockwise) label.pos<--label.pos
+ if(start) label.pos<-label.pos+start
+ # display the circumferential grid
+ angles<-seq(0,1.96*pi,by=0.04*pi)
+ for(i in seq(length(grid.pos),1,by=-1)) {
+  xpos<-cos(angles)*(grid.pos[i]-radial.lim[1])
+  ypos<-sin(angles)*(grid.pos[i]-radial.lim[1])
+  polygon(xpos,ypos,border=grid.col,col=grid.bg)
+ }
+ maxlength<-max(grid.pos)-radial.lim[1]
+ # display the radial grid
+ if(show.radial.grid) {
+  xpos<-cos(label.pos)*maxlength
+  ypos<-sin(label.pos)*maxlength
+  segments(0,0,xpos,ypos,col=grid.col)
+  xpos<-cos(label.pos)*maxlength
+  ypos<-sin(label.pos)*maxlength
+ }
+ # display the circumferential labels
+ if(!is.null(labels)) {
+  xpos<-cos(label.pos)*maxlength*label.prop
+  ypos<-sin(label.pos)*maxlength*label.prop
+  if(radlab) {
+   for(label in 1:length(labels)) {
+    labelsrt<-(180*label.pos[label]/pi)+
+     180*(label.pos[label] > pi/2 && label.pos[label] < 3*pi/2)
+    text(xpos[label],ypos[label],labels[label],cex=par("cex.axis"),
+     srt=labelsrt)
+   }
+  }
+  else
+   boxed.labels(xpos,ypos,labels,ypad=0.7,border=FALSE,cex=par("cex.axis"))
+ }
+ par(xpd=FALSE)
+}
diff --git a/R/radial.pie.R b/R/radial.pie.R
new file mode 100644
index 0000000..1800653
--- /dev/null
+++ b/R/radial.pie.R
@@ -0,0 +1,121 @@
+drawSectorAnnulus<-function(angle1,angle2,radius1,radius2,col,angleinc=0.03) {
+ if(angle1 > angle2) {
+  temp<-angle1
+  angle1<-angle2
+  angle2<-temp
+ }
+ if(radius1 > radius2) {
+  temp<-radius1
+  radius1<-radius2
+  radius2<-temp
+ }
+ angles<-seq(angle1,angle2,by=angleinc)
+ angles[length(angles)]<-angle2
+ xpos<-c(cos(angles)*radius1,cos(rev(angles))*radius2)
+ ypos<-c(sin(angles)*radius1,sin(rev(angles))*radius2)
+ polygon(xpos,ypos,col=col,border=col)
+}
+
+# plots sectors composed of one or more sectors of annuli on a circular grid.
+# radial.extents are the radial extents of the sectors (a vector),
+# optionally with sub-extents that define the annuli
+# (a matrix with each sector a column)
+# sector.edges are the positions of the radii that define the sectors,
+# defaulting to n equal sectors filling the circle where
+# n is the number of radial extents.
+# sector.values are the values in each sector of an annulus that
+# will be represented by colors and must be the same data type and
+# dimension as radial.extents.
+# If a list of sector colors is passed, it will take precedence
+# and sector.colors will not be scaled from sector.values
+
+radial.pie<-function(radial.extents,sector.edges=NULL,
+ sector.colors=NULL,cs1=c(0,1),cs2=c(0,1),cs3=c(0,1),alpha=1,
+ labels=NA,label.pos=NULL,radlab=FALSE,start=0,clockwise=FALSE,
+ label.prop=1.1,radial.lim=NULL,main="",xlab="",ylab="",mar=c(2,2,3,2),
+ show.grid=TRUE,show.grid.labels=4,show.radial.grid=TRUE,
+ grid.col="gray",grid.bg="transparent",grid.unit=NULL,
+ radial.labels=NULL,boxed.radial=TRUE,add=FALSE,...) {
+ 
+ if(is.null(radial.lim)) radial.lim<-range(radial.extents)
+ if(is.null(sector.edges)) {
+  if(clockwise)
+   sector.edges<-seq(2*pi+start,start,length.out=length(radial.extents)+1)
+  else
+   sector.edges<-seq(start,2*pi+start,length.out=length(radial.extents)+1)
+ }
+ if(is.null(label.pos))
+  label.pos<-sector.edges[-length(sector.edges)]+diff(sector.edges)/2
+ if(show.grid) {
+  if(length(radial.lim) < 3) grid.pos<-pretty(radial.lim)
+  else grid.pos<-radial.lim
+  if(grid.pos[1] < radial.lim[1]) grid.pos<-grid.pos[-1]
+  maxlength<-max(grid.pos-radial.lim[1])
+ }
+ else {
+  grid.pos<-NA
+  maxlength<-diff(radial.lim)
+ }
+ oldpar<-par("xpd","mar","pty")
+ if(!add) {
+  par(mar=mar,pty="s")
+  maxrad<-max(unlist(radial.extents))
+  plot(0,xlim=c(-maxrad,maxrad),ylim=c(-maxrad,maxrad),type="n",
+   axes=FALSE,xlab=xlab,ylab=ylab)
+  if(show.grid)
+   radial.grid(labels=labels,label.pos=label.pos,radlab=radlab,
+    radial.lim=radial.lim,start=start,clockwise=clockwise,
+    label.prop=label.prop,grid.pos=grid.pos,
+    grid.col=grid.col,grid.bg=grid.bg)
+ }
+ fadeColor<-function(col,nfades) {
+  rgbcol<-col2rgb(col)
+  redinc<-(255-rgbcol[1])/nfades
+  reds<-(rgbcol[1]+0:nfades*redinc)/255
+  greeninc<-(255-rgbcol[2])/nfades
+  greens<-(rgbcol[2]+0:nfades*greeninc)/255
+  blueinc<-(255-rgbcol[3])/nfades
+  blues<-(rgbcol[3]+0:nfades*blueinc)/255
+  return(rgb(reds[1:nfades],greens[1:nfades],blues[1:nfades]))
+ }
+ nsectors<-length(radial.extents)
+ if(is.list(radial.extents)) {
+  if(is.null(sector.colors)) sector.colors<-rainbow(nsectors)
+  for(sector in 1:nsectors) {
+   annuli<-radial.extents[[sector]]
+   annulus.colors<-fadeColor(sector.colors[[sector]],length(annuli))
+   for(annulus in 1:(length(annuli)-1)) {
+    drawSectorAnnulus(sector.edges[[sector]],sector.edges[[sector+1]],
+     annuli[annulus],annuli[annulus+1],annulus.colors[annulus])    
+   }
+  }
+ }
+ else {
+  if(is.null(sector.colors)) sector.colors<-rainbow(nsectors)
+  for(sector in 1:nsectors) {
+   drawSectorAnnulus(sector.edges[sector],sector.edges[sector+1],
+    0,radial.extents[sector],sector.colors[sector])
+  }
+ }
+ if(show.grid.labels) {
+  if(show.grid.labels%%2) {
+   ypos<-grid.pos-radial.lim[1]
+   xpos<-rep(0,length(grid.pos))
+   if(show.grid.labels==1) ypos<--ypos
+  }
+  else {
+   xpos<-grid.pos-radial.lim[1]
+   ypos<-rep(0,length(grid.pos))
+   if(show.grid.labels==2) xpos<--xpos
+  }
+  if(is.null(radial.labels)) radial.labels<-grid.pos
+  if(!is.null(grid.unit))
+   radial.labels[length(grid.pos)]<-
+    paste(radial.labels[length(grid.pos)],grid.unit)
+  if(boxed.radial)
+   boxed.labels(xpos,ypos,radial.labels,border=FALSE,
+    cex=par("cex.lab"))
+  else text(xpos,ypos,radial.labels,cex=par("cex.lab"))
+ }
+ invisible(oldpar)
+}
diff --git a/R/radial.plot.R b/R/radial.plot.R
new file mode 100755
index 0000000..1ac53da
--- /dev/null
+++ b/R/radial.plot.R
@@ -0,0 +1,210 @@
+# plots data as radial lines or a polygon on a 24 hour "clockface" going 
+# clockwise. clock.pos should be in decimal hours between 0 and 24.
+# Remember to convert hour/minute values to hour/decimal values.
+# example: clock24.plot(rnorm(16)+3,seq(5.5,20.5,length.out=16))
+
+clock24.plot<-function(lengths,clock.pos,labels=0:23,minutes=FALSE,
+ label.pos=NULL,rp.type="r",...) {
+ 
+ npos<-length(lengths)
+ # if no positions are given, spread the lines out over the circle 
+ if(missing(clock.pos)) clock.pos<-seq(0,24-24/(npos+1),length=npos)
+ # start at "midnight" and go clockwise
+ radial.pos<-pi*(clock.pos*15)/180
+ if(minutes) labels<-paste(labels,"00",sep=":")
+ if(is.null(label.pos)) label.pos<-seq(0,pi*1.917,length.out=24)
+ invisible(radial.plot(lengths,radial.pos,labels=labels,label.pos=label.pos,
+  rp.type=rp.type,start=pi/2,clockwise=TRUE,...))
+}
+
+# plots data as radial lines or a polygon starting at the right and going
+# counterclockwise.
+# angles should be given in 0-360 values, use radial.plot for radians
+# example: polar.plot(rnorm(20)+3,seq(90,280,by=10))
+
+polar.plot<-function(lengths,polar.pos=NULL,labels,label.pos=NULL,
+ start=0,clockwise=FALSE,rp.type="r",...) {
+ 
+ npos<-length(lengths)
+ # if no positions are given, add the average distance between positions so that
+ # the first and last line don't overlap
+ if(is.null(polar.pos)) radial.pos<-seq(0,(2-2/(npos+1))*pi,length=npos)
+ else radial.pos<-pi*polar.pos/180
+ if(start) start<-pi*start/180
+ if(is.null(label.pos)) label.pos<-seq(0,1.89*pi,length=18)
+ else label.pos<-pi*label.pos/180
+ if(missing(labels)) labels<-as.character(seq(0,340,by=20))
+ invisible(radial.plot(lengths,radial.pos,labels,label.pos,start=start,
+  clockwise=clockwise,rp.type=rp.type,...))
+}
+
+# plots radial lines of length 'lengths', symbols at 'lengths' from the
+# center or a polygon with corresponding vertices at 'radial.pos' in radians.
+# starts at the 'east' position and goes counterclockwise unless
+# the "start" and "clockwise" arguments are changed
+# label.prop is the proportion of max(lengths) that gives the
+# radial position of the labels
+
+radial.plot<-function(lengths,radial.pos=NULL,labels=NA,label.pos=NULL,
+ radlab=FALSE,start=0,clockwise=FALSE,rp.type="r",label.prop=1.1,main="",
+ xlab="",ylab="",line.col=par("fg"),lty=par("lty"),lwd=par("lwd"),
+ mar=c(2,2,3,2),show.grid=TRUE,show.grid.labels=4,show.radial.grid=TRUE,
+ rad.col="gray",grid.col="gray",grid.bg="transparent",grid.left=FALSE,
+ grid.unit=NULL,point.symbols=1,point.col=par("fg"),show.centroid=FALSE,
+ radial.lim=NULL,radial.labels=NULL,boxed.radial=TRUE,poly.col=NA,
+ add=FALSE,...) {
+ 
+ if(is.null(radial.lim)) radial.lim<-range(lengths)
+ length.dim<-dim(lengths)
+ if(is.null(length.dim)) {
+  npoints<-length(lengths)
+  nsets<-1
+  lengths<-matrix(lengths,nrow=1)
+ }
+ else {
+  npoints<-length.dim[2]
+  nsets<-length.dim[1]
+  lengths<-as.matrix(lengths)
+ }
+ lengths<-lengths-radial.lim[1]
+ lengths[lengths<0]<-NA
+ if(is.null(radial.pos))
+  radial.pos<-seq(0,pi*(2 - 2 * (rp.type != "l")/npoints),length.out=npoints)
+ radial.pos.dim<-dim(radial.pos)
+ if(is.null(radial.pos.dim))
+  radial.pos<-matrix(rep(radial.pos,nsets),nrow=nsets,byrow=TRUE)
+ else radial.pos<-as.matrix(radial.pos)
+ if(rp.type == "l") {
+  clockwise<-TRUE
+  start<-pi/2
+ }
+ if(clockwise) radial.pos<--radial.pos
+ if(start) radial.pos<-radial.pos+start
+ if(show.grid) {
+  if(length(radial.lim) < 3) grid.pos<-pretty(radial.lim)
+  else grid.pos<-radial.lim
+  if(grid.pos[1] < radial.lim[1]) grid.pos<-grid.pos[-1]
+  maxlength<-max(grid.pos-radial.lim[1])
+  angles<-seq(0,1.96*pi,by=0.04*pi)
+ }
+ else {
+  grid.pos<-NA
+  maxlength<-diff(radial.lim)
+ }
+ oldpar<-par("xpd","mar","pty")
+ if(!add) {
+  par(mar=mar,pty="s")
+  plot(c(-maxlength,maxlength),c(-maxlength,maxlength),type="n",axes=FALSE,
+   main=main,xlab=xlab,ylab=ylab)
+  if(is.null(label.pos)) {
+   if(is.null(labels)) nlpos<-ifelse(npoints > 8,8,npoints)
+   else {
+    if(is.na(labels[1])) nlpos<-ifelse(npoints > 8,8,npoints)
+    else nlpos<-length(labels)
+   }
+   label.pos<-seq(0,pi*(2-2/nlpos),length.out=nlpos)
+  }
+  if(show.grid) {
+   radial.grid(labels=labels,label.pos=label.pos,radlab=radlab,
+    radial.lim=radial.lim,start=start,clockwise=clockwise,
+    label.prop=label.prop,grid.pos=grid.pos,grid.col=grid.col,
+    grid.bg=grid.bg,show.radial.grid=show.radial.grid)
+  }
+ }
+ par(xpd=TRUE)
+ # stretch everything out to the correct length
+ if(length(line.col) < nsets) line.col<-1:nsets
+ if(length(rp.type) < nsets) rp.type<-rep(rp.type,length.out=nsets)
+ if(length(point.symbols) < nsets)
+  point.symbols<-rep(point.symbols,length.out=nsets)
+ if(length(point.col) < nsets) point.col<-rep(point.col,length.out=nsets)
+ if(length(poly.col) < nsets) poly.col<-rep(poly.col,length.out=nsets)
+ if(length(lty) < nsets) lty<-rep(lty,length.out=nsets)
+ if(length(lwd) < nsets) lwd<-rep(lwd,length.out=nsets)
+ for(i in 1:nsets) {
+  if(nsets > 1) {
+   linecol<-line.col[i]
+   polycol<-poly.col[i]
+   pointcol<-point.col[i]
+   pointsymbols<-point.symbols[i]
+   ltype<-lty[i]
+   lwidth<-lwd[i]
+  }
+  else {
+   linecol<-line.col
+   polycol<-poly.col
+   pointcol<-point.col
+   pointsymbols<-point.symbols
+   ltype<-lty
+   lwidth<-lwd
+  }
+  # split up rp.type if there is a combination of displays
+  rptype<-unlist(strsplit(rp.type[i],""))
+  if(match("s",rptype,0)) {
+   if(is.null(pointsymbols)) pointsymbols<-i
+   if(is.null(pointcol)) pointcol<-i
+  }
+  # get the vector of x positions
+  xpos<-cos(radial.pos[i,])*lengths[i,]
+  # get the vector of y positions
+  ypos<-sin(radial.pos[i,])*lengths[i,]
+  # plot radial lines if rp.type == "r"    
+  if(match("r",rptype,0))
+   segments(0,0,xpos,ypos,col=linecol,lty=ltype,lwd=lwidth,...)
+  if(match("p",rptype,0))
+   polygon(xpos,ypos,border=linecol,col=polycol,lty=ltype,
+    lwd=lwidth,...)
+  if(match("s",rptype,0))
+   points(xpos,ypos,pch=pointsymbols,col=pointcol,...)
+  if(match("l",rptype,0))
+   lines(xpos,ypos,lty=ltype,lwd=lwidth,col=linecol,...)
+  if(show.centroid) {
+   if(match("p",rptype,0)) {
+    nvertices<-length(xpos)
+    # first get the "last to first" area component
+    polygonarea<-xpos[nvertices]*ypos[1] - xpos[1]*ypos[nvertices]
+    for(vertex in 1:(nvertices-1))
+     polygonarea<-
+      polygonarea+xpos[vertex]*ypos[vertex+1]-xpos[vertex+1]*ypos[vertex]
+    polygonarea<-polygonarea/2
+    centroidx<-
+     (xpos[nvertices]+xpos[1])*(xpos[nvertices]*ypos[1]-xpos[1]*ypos[nvertices])
+    centroidy<-
+     (ypos[nvertices]+ypos[1])*(xpos[nvertices]*ypos[1]-xpos[1]*ypos[nvertices])
+    for(vertex in 1:(nvertices-1)) {
+     centroidx<-centroidx + (xpos[vertex]+xpos[vertex+1])*
+      (xpos[vertex]*ypos[vertex+1]-xpos[vertex+1]*ypos[vertex])
+     centroidy<-centroidy + (ypos[vertex]+ypos[vertex+1])*
+      (xpos[vertex]*ypos[vertex+1]-xpos[vertex+1]*ypos[vertex])
+    }
+    points(centroidx/(6*polygonarea),centroidy/(6*polygonarea),
+     col=point.col[i],pch=point.symbols[i],cex=2,...)
+   
+   }
+   else
+    points(mean(xpos),mean(ypos),col=pointcol,pch=pointsymbols,
+     cex=2,...)
+  }
+ }
+ if(show.grid.labels && !add) {
+  if(show.grid.labels%%2) {
+   ypos<-grid.pos-radial.lim[1]
+   xpos<-rep(0,length(grid.pos))
+   if(show.grid.labels==1) ypos<--ypos
+  }
+  else {
+   xpos<-grid.pos-radial.lim[1]
+   ypos<-rep(0,length(grid.pos))
+   if(show.grid.labels==2) xpos<--xpos
+  }
+  if(is.null(radial.labels)) radial.labels<-grid.pos
+  if(!is.null(grid.unit))
+   radial.labels[length(grid.pos)]<-
+    paste(radial.labels[length(grid.pos)],grid.unit)
+  if(boxed.radial)
+   boxed.labels(xpos,ypos,radial.labels,border=FALSE,
+    cex=par("cex.lab"))
+  else text(xpos,ypos,radial.labels,cex=par("cex.lab"))
+ }
+ invisible(oldpar)
+}
diff --git a/R/radial.plot.labels.R b/R/radial.plot.labels.R
new file mode 100755
index 0000000..5c8a10d
--- /dev/null
+++ b/R/radial.plot.labels.R
@@ -0,0 +1,22 @@
+radial.plot.labels<-function(lengths,radial.pos=NULL,units="radians",
+ radial.lim=NULL,start=0,clockwise=FALSE,labels,adj=NULL,pos=NULL,...) {
+
+ npoints<-length(lengths)
+ if(is.null(radial.pos))
+  radial.pos<-seq(0,pi*(2-2/npoints),length.out=npoints)
+ else {
+  # clock24 starts at "midnight" and always runs clockwise
+  if(units == "clock24") radial.pos<-pi*(450-radial.pos*15)/180
+  # polar starts at 3 o'clock and runs counterclockwise by default
+  if(units == "polar") radial.pos<-pi*radial.pos/180
+ }
+ if(clockwise && units != "clock24") radial.pos<--radial.pos
+ if(start && units != "clock24") radial.pos<-radial.pos+start
+ if(is.null(radial.lim)) radial.lim<-range(lengths)
+ lengths<-lengths-radial.lim[1]
+ # get the vector of x positions
+ xpos<-cos(radial.pos)*lengths
+ # get the vector of y positions
+ ypos<-sin(radial.pos)*lengths
+ text(x=xpos,y=ypos,labels=labels,adj=adj,pos=pos,...)
+}
diff --git a/R/radialtext.R b/R/radialtext.R
new file mode 100644
index 0000000..8cda16a
--- /dev/null
+++ b/R/radialtext.R
@@ -0,0 +1,62 @@
+radialtext <- function(x, center=c(0,0), start=NA, middle=1, end=NA, angle=0, deg=NA,
+    expand=0, stretch=1, nice=TRUE, cex=NA, ...) 
+    {
+    oldcex <- par("cex")
+    if (is.na(cex))
+        cex <- oldcex
+    par(cex=cex)
+    if (is.na(deg))
+        deg <- angle*180/pi
+    deg <- deg %% 360
+    chardeg <- deg
+    if (nice && (deg > 90 && deg < 270))
+        {
+        chardeg <- (deg + 180) %% 360
+        x <- paste(rev(unlist(strsplit(x, ""))),collapse="")
+        }
+    angle <- deg*pi/180
+    xvec <- strsplit(x, "")[[1]]
+    lenx <- length(xvec)
+    xwidths <- stretch * strwidth(xvec)
+    xwrange <- range(xwidths)
+    xwidths[xwidths < xwrange[2]/2] <- xwrange[2]/2 # Make really narrow characters wider
+    # Compute expand factor for each character and adjust character widths accordingly.
+    chexp <- rep(1, lenx)
+    if (!is.na(start) && expand != 0)
+        {
+        # Note: width of each char changes in succession, affecting sizes AND positions.
+        expfactor <- expand/start
+        deltar <- 0
+        for (xchar in 2:lenx)
+            {
+            deltar <- deltar + xwidths[xchar-1]
+            expansion <- 1+deltar*expfactor
+            if (expansion < 0.1) expansion <- 0.1
+            chexp[xchar] <- expansion
+            xwidths[xchar] <- xwidths[xchar]*expansion
+            }
+        }
+    # Find start distance
+    if (is.na(start))
+        {
+        if (is.na(end))
+            start <- middle - sum(xwidths)/2
+        else
+            start <- end - sum(xwidths)
+        }
+    cosang <- cos(angle)
+    sinang <- sin(angle)
+    charstart <- c(start, start + cumsum(xwidths)[-lenx])
+    charpos <- charstart + xwidths/2
+    xylim <- par("usr")
+    plotdim <- par("pin")
+    ymult <- (xylim[4] - xylim[3])/(xylim[2] - xylim[1]) * plotdim[1]/plotdim[2]
+    for (xchar in 1:lenx)
+        {
+        par(cex=cex*chexp[xchar])
+        text(center[1] + charpos[xchar] * cosang, 
+            center[2] + charpos[xchar] * ymult * sinang, xvec[xchar], 
+            adj=c(0.5, 0.5), srt=chardeg, ...)
+        }
+    par(cex=oldcex)
+    }
diff --git a/R/raw.means.plot.R b/R/raw.means.plot.R
new file mode 100755
index 0000000..fbf4674
--- /dev/null
+++ b/R/raw.means.plot.R
@@ -0,0 +1,209 @@
+
+# more explanatory name for the function
+raw.means.plot <-function(data, col.offset = 2, col.x = 3, col.value = 4,  na.rm = FALSE,
+    avoid.overlap = c("y", "x", "both"), y.factor = 1, y.amount = NULL, x.amount = 0.05,
+    pch = 21:25, lty = 1:5, bg.b.col = "darkgrey", 
+    bg.f.col = NULL, fg.b.col = "black", fg.f.col = "black", 
+    type = "o", pt.cex = 1, lwd = 1, xlab = "", ylab = "", ylim, 
+    max.offset = 0.2, xaxis = TRUE, x.labels, xaxt = "n", plot = TRUE, 
+    legend = TRUE, mar = NULL, reset.mar = TRUE, l.pos, yjust = 0.5, 
+    l.bty = "n", l.adj = c(0, 0.5), ...) 
+{
+    # I somehow like more the idea of using random jitter.
+		
+    spread.out <- function(x, x.amount) {
+        dupl <- duplicated(x)
+        spreadx <- rep(0,length(x))
+        spreadx[dupl] <- jitter(spreadx[dupl], amount = x.amount)
+        return(spreadx)
+    }
+	
+	addJitter <- function (x, y.factor, y.amount) {
+		dupl <- duplicated(x)
+		x[dupl] <- jitter(x[dupl], factor = y.factor, amount = y.amount)
+		return(x)
+	}
+	
+	
+    # I personally more like the spreading on the y-axis, but I totally agree that 
+	# spacing on the x-axis is also totally reasonable.
+    create.dp <- function(lst, n.x, avoid.overlap, y.factor, y.amount, x.amount) {
+        ret <- vector("list", 2)
+		#browser()
+		if (avoid.overlap[1] %in% c("x", "both")) 
+			ret[[1]] <- rep(1:n.x, vapply(lst, length, 0)) +
+			unlist(lapply(lst, spread.out, x.amount = x.amount))
+		else ret[[1]] <- rep(1:n.x, vapply(lst, length, 0))
+		if (avoid.overlap[1] %in% c("y", "both")) 
+			ret[[2]] <- unlist(lapply(lst, addJitter, y.factor=y.factor, y.amount = y.amount))
+		else ret[[2]] <- unlist(lst)
+        return(ret)
+    }
+    largs <- c("fill", "border", "angle", "density", "box.lwd", 
+        "box.lty", "box.col", "pt.lwd", "xjust", "x.intersp", 
+        "y.intersp", "text.width", "text.col", "merge", "trace", 
+        "plot", "ncol", "horiz", "title", "inset", "title.col", 
+        "title.adj")
+    dots <- list(...)
+    args.to.l <- dots[names(dots) %in% largs]
+    args.to.p <- dots[!(names(dots) %in% largs)]
+    if (!is.data.frame(data)) 
+        stop("data must be a data.frame")
+    # I used "any" here as it seems more straightforward
+    # I notice that you used it in add.ps
+    if (any(is.na(data[, c(col.offset, col.x)]))) 
+        warning("NAs in offset or x column (this produces other warnings).")
+    # as above
+    if (na.rm == FALSE) 
+        if (any(is.na(data[, c(col.value)]))) 
+            stop("NAs in data column. Try: na.rm = TRUE")
+    if (!is.factor(data[, col.offset])) {
+        warning(paste("Converting offset variable (column ", 
+            col.offset, ") to factor.", sep = ""))
+        data[, col.offset] <- factor(data[, col.offset])
+    }
+    if (!is.factor(data[, col.x])) {
+        warning(paste("Converting x-axis variable (column ", 
+            col.offset, ") to factor.", sep = ""))
+        data[, col.x] <- factor(data[, col.x])
+    }
+    if ((length(levels(data[, col.x])) != length(unique(data[, col.x])))) {
+        warning(paste("Refactoring x-axis variable (column ", 
+            col.x, ") due to length mismatch.", sep = ""))
+        data[, col.x] <- factor(data[, col.x])
+    }
+    if ((length(levels(data[, col.offset])) != length(unique(data[, 
+        col.offset])))) {
+        warning(paste("Refactoring offset variable (column ", 
+            col.offset, ") due to length mismatch.", sep = ""))
+        data[, col.offset] <- factor(data[, col.offset])
+    }
+    if (missing(ylim)) {
+        # I think that range is equivalent to c(min,max) here
+        ylim <- range(data[, col.value], na.rm = na.rm)
+        warning(paste("ylim not specified, taken from data: ", 
+            ylim[1], " - ", ylim[2], sep = ""))
+    }
+    n.offset <- length(levels(data[, col.offset]))
+    n.x <- length(levels(data[, col.x]))
+    if (!(missing(x.labels))) {
+        if (length(x.labels) < n.x) {
+            warning("x.labels too short, taking unique(data[,col.x]) as labels at x-axis ticks")
+            x.labels <- levels(data[, col.x])
+        }
+    }
+    while (length(pch) < n.offset) {
+        warning("pch vector too short. recycling pch vector.")
+        # this makes sure that the pch vector will be long enough
+        pch <- rep(pch, length.out=n.offset)
+    }
+    while (length(lty) < n.offset) {
+        warning("lty vector too short. recycling lty vector.")
+        # ditto for the line type
+        lty <- rep(lty, length.out=n.offset)
+    }
+    if (!is.null(bg.b.col)) {
+      while (length(bg.b.col) < n.offset) {
+        bg.b.col <- rep(bg.b.col, length.out=n.offset)
+      }
+    }
+    if (!is.null(bg.f.col)) {
+      while (length(bg.f.col) < n.offset) {
+        bg.f.col <- rep(bg.f.col, length.out=n.offset)
+      }
+    }
+    if (!is.null(fg.b.col)) {
+      while (length(fg.b.col) < n.offset) {
+        fg.b.col <- rep(fg.b.col, length.out=n.offset)
+      }
+    }
+    if (!is.null(fg.f.col)) {
+      while (length(fg.f.col) < n.offset) {
+        fg.f.col <- rep(fg.f.col, length.out=n.offset)
+      }
+    }
+    if (missing(x.labels)) {
+        x.labels <- levels(data[, col.x])
+    }
+    orig.mar <- par("mar")
+    if (legend == TRUE & is.null(mar)) {
+        mar <- orig.mar
+        max.l <- max(nchar(levels(data[, col.offset])))
+        if (max.l < 3) 
+            rb <- 4.2
+        else if (max.l > 2 & max.l < 5) 
+            rb <- 5
+        else if (max.l > 4 & max.l < 7) 
+            rb <- 6
+        else if (max.l > 6 & max.l < 9) 
+            rb <- 7
+        else rb <- 8
+        mar[4] <- rb + 0.1
+    }
+    if (!plot) 
+        mar <- c(0, 0, 0, 0)
+    if (!is.null(mar)) 
+        res.mar <- par(mar = mar)
+    nd <- split(data, data[, col.offset])
+    if (plot) {
+        do.call("plot", c(list(x = 1, y = 2, xlim = c((1 - max.offset - 
+            0.2), (n.x + max.offset + 0.2)), ylim = ylim, xaxt = xaxt, 
+            type = "n", xlab = xlab, ylab = ylab), args.to.p))
+        if (n.offset > 1) {
+            offset.start <- max.offset - ((1 - (n.offset%%2)) * 
+                (max.offset/n.offset))
+            offset.dist <- max.offset/((n.offset - (n.offset%%2))/2)
+        }
+        if (n.offset == 1) {
+            offset.start <- 0
+            offset.dist <- 0
+        }
+        for (c in 1:n.offset) {
+            d.c <- nd[[c]]
+            d.lst <- split(d.c[, col.value], d.c[, col.x])
+            dp <- create.dp(lst = d.lst, n.x = n.x, avoid.overlap = avoid.overlap, y.factor = y.factor, y.amount = y.amount, x.amount = x.amount)
+            x <- dp[[1]] - ((offset.start) - ((c - 1) * offset.dist))
+            y <- dp[[2]]
+            points(x, y, pch = pch[c], col = bg.b.col[c], bg = bg.f.col[c], 
+                cex = pt.cex)
+        }
+        for (c in 1:n.offset) {
+            d.c <- nd[[c]]
+            d.lst <- split(d.c[, col.value], d.c[, col.x])
+            x <- 1:n.x - ((offset.start) - ((c - 1) * offset.dist))
+            y <- vapply(d.lst, mean, 0, na.rm = na.rm)
+            lines(x, y, pch = pch[c], type = type, lty = lty[c], 
+                col = fg.b.col[c], bg = fg.f.col[c], cex = pt.cex, 
+                lwd = lwd)
+        }
+        if (xaxis == TRUE) 
+            axis(side = 1, at = 1:n.x, labels = x.labels)
+    }
+    if (!plot) {
+        plot(0, 0, type = "n", xlim = c(0, 10), ylim = c(0, 10), 
+            axes = FALSE, ylab = "", xlab = "", mar = c(0, 0, 
+                0, 0))
+        if (missing(l.pos)) 
+            l.pos = c(5, 5)
+    }
+    if (legend == TRUE) {
+        if (n.x == 1) {
+            if (missing(l.pos)) {
+                l.pos <- (n.x + 0.45)
+                l.pos[2] <- (ylim[2] - ((ylim[2] - ylim[1])/2))
+            }
+            lty <- NULL
+        }
+        else (if (missing(l.pos)) {
+            l.pos <- (n.x + max.offset + 0.4)
+            l.pos[2] <- (ylim[2] - ((ylim[2] - ylim[1])/2))
+        })
+        do.call("legend", c(list(x = l.pos[1], y = l.pos[2], 
+            levels(data[, col.offset]), pch = pch, lty = lty, col = fg.b.col, 
+            pt.bg = fg.f.col, yjust = yjust, bty = l.bty, adj = l.adj, 
+            xpd = TRUE, pt.cex = pt.cex, lwd = lwd), args.to.l))
+    }
+    if (legend == TRUE & reset.mar == TRUE) {
+        par(mar = res.mar)
+    }
+}
diff --git a/R/rectFill.R b/R/rectFill.R
new file mode 100755
index 0000000..d7c4edc
--- /dev/null
+++ b/R/rectFill.R
@@ -0,0 +1,28 @@
+rectFill<-function(x1,y1,x2,y2,fg=par("fg"),bg=par("bg"),xinc=NA,yinc=NA,
+ pch=1,pch.cex=1,pch.col=par("fg"),...) {
+
+ if(is.na(xinc[1])) xinc<-strwidth(pch,cex=pch.cex)
+ if(is.na(yinc[1])) yinc<-strheight(pch,cex=pch.cex)
+ nrect<-length(x1)
+ if(length(fg) < nrect) fg<-rep(fg,nrect)
+ if(length(bg) < nrect) bg<-rep(bg,nrect)
+ if(length(xinc) < nrect) xinc<-rep(xinc,nrect)
+ if(length(yinc) < nrect) yinc<-rep(yinc,nrect)
+ if(length(pch) < nrect) pch<-rep(pch,nrect)
+ if(length(pch.cex) < nrect) pch.cex<-rep(pch.cex,nrect)
+ if(length(pch.col) < nrect) pch.col<-rep(pch.col,nrect)
+ for(frect in 1:nrect) {
+  rect(x1[frect],y1[frect],x2[frect],y2[frect],col=bg[frect],border=fg[frect])
+  if(yinc[frect] > 0) {
+   xpos<-seq(x1[frect]+xinc[frect]/2,x2[frect]+xinc[frect]/2,by=xinc[frect])
+   lenxpos<-length(xpos)
+   ypos<-seq(y1[frect]+yinc[frect]/2,y2[frect]+yinc[frect],by=yinc[frect])
+   lenypos<-length(ypos)
+   xpos<-rep(xpos,each=lenypos)
+   ypos<-rep(ypos,lenxpos)
+   clip(x1[frect],x2[frect],y1[frect],y2[frect])
+   points(xpos,ypos,pch=pch[frect],cex=pch.cex[frect],col=pch.col[frect],...)
+  }
+ }
+ do.call(clip,as.list(par("usr")))
+}
diff --git a/R/rescale.R b/R/rescale.R
new file mode 100755
index 0000000..f5d7199
--- /dev/null
+++ b/R/rescale.R
@@ -0,0 +1,24 @@
+# linearly transforms a vector or matrix of numbers to a new range
+
+rescale<-function(x,newrange) {
+ if(missing(x) | missing(newrange)) {
+  usage.string<-paste("Usage: rescale(x,newrange)\n",
+   "\twhere x is a numeric object and newrange is the new min and max\n",
+   sep="",collapse="")
+  stop(usage.string)
+ }
+ if(is.numeric(x) && is.numeric(newrange)) {
+  xna<-is.na(x)
+  if(all(xna)) return(x)
+  if(any(xna)) xrange<-range(x[!xna])
+  else xrange<-range(x)
+  # if x is constant, just return it
+  if(xrange[1] == xrange[2]) return(x)
+  mfac<-(newrange[2]-newrange[1])/(xrange[2]-xrange[1])
+  return(newrange[1]+(x-xrange[1])*mfac)
+ }
+ else {
+  warning("Only numeric objects can be rescaled")
+  return(x)
+ }
+}
diff --git a/R/revaxis.R b/R/revaxis.R
new file mode 100755
index 0000000..5e8d1ef
--- /dev/null
+++ b/R/revaxis.R
@@ -0,0 +1,35 @@
+# Function revaxis --- rev for ``reverse'' (to reverse the direction of
+# axes).
+#
+# Written by T. Rolf Turner, University of New Brunswick (now
+# with the Starpath Project, Universtiy of Auckland).
+#
+# Some bugs fixed 7/2/02, with the assistance of Herberto Ghezzo
+# of McGill University.
+#
+revaxis<-function(x,y,xrev=FALSE,yrev=TRUE,xside=if(yrev) 3 else 1,
+ yside=if(xrev) 4 else 2,xlab=NULL,ylab=NULL,bty=NULL,...) {
+ 
+ xname <- if(is.null(xlab)) deparse(substitute(x)) else xlab
+ yname <- if(is.null(ylab)) deparse(substitute(y)) else ylab
+ xlab <- if(yrev) "" else xname
+ ylab <- if(xrev) "" else yname
+ y1 <- if(yrev) -y else y
+ x1 <- if(xrev) -x else x
+ old.mar <- par()$mar
+ on.exit(par(mar = old.mar))
+ par(mar = old.mar[c(xside, yside, 4 - xside, 6 - yside)])
+ plot(x1, y1, axes = FALSE, xlab = xlab, ylab = ylab, ...)
+ if(xrev) {
+  axis(xside, at = pretty(-x), labels = rev(pretty(x)))
+  mtext(side = yside, line = 2, text = yname)
+ }
+ else axis(xside)
+ if(yrev) {
+  axis(yside,at=pretty(-y),labels=rev(pretty(y)),srt=90)
+  mtext(side=xside,line=3,text=xname)
+ }
+ else axis(yside)
+ if(!is.null(bty)) box(bty = bty)
+ invisible()
+}
diff --git a/R/rm.plot2.R b/R/rm.plot2.R
new file mode 100755
index 0000000..9d9b447
--- /dev/null
+++ b/R/rm.plot2.R
@@ -0,0 +1,14 @@
+
+raw.means.plot2 <- function(data, col.id, col.offset, col.x, col.value, fun.aggregate = "mean", ... ) {
+	
+	if(!is.data.frame(data)) stop("data must be a data.frame")
+	
+	columns <- c(col.id, col.offset, col.x, col.value)
+	
+	if (any(!(columns %in% colnames(data)))) stop("column not matching the data")
+	
+	formula.agg <- as.formula(paste(col.value, "~", col.id, "+", col.offset, "+", col.x))
+	
+	d.new <- aggregate(formula.agg, data = data, FUN = fun.aggregate)
+	raw.means.plot(d.new, col.offset = col.offset, col.x = col.x, col.value = col.value, ...)
+}
diff --git a/R/ruginv.R b/R/ruginv.R
new file mode 100644
index 0000000..de41e85
--- /dev/null
+++ b/R/ruginv.R
@@ -0,0 +1,37 @@
+ruginv<-function(x,ticksize=0.03,side=1,lwd=0.5,col=par("fg"),
+ col.ticks="white",quiet=getOption("warn")<0,...) {
+
+ x<-as.vector(x)
+ ok=is.finite(x)
+ x<-x[ok]
+ if(!quiet) {
+  u<-par("usr")
+  if(side%%2 == 1) {
+   if(par("xlog")) u<-10^u[1:2]
+   else u<-u[1:2]
+  }
+  else {
+   if(par("ylog")) u<-10^u[3:4]
+   else u<-u[3:4]
+  }
+  if(any(x < u[1] | x > u[2])) warning("Some values will be clipped")
+ }
+ u<-par("usr")
+ par("pin")
+ if(ticksize < 0.5) tic<-min(diff(u[3:4]),diff(u[1:2]))*ticksize
+ else tic<-ifelse(side%%2 == 1,diff(u[3:4]),diff(u[1:2]))*ticksize
+ if(ticksize < 0) opar<-par(xpd=TRUE)
+ switch(as.character(side),
+  "1"=polygon(u[c(1,2,2,1,1)],u[3]+c(0,0,tic,tic,0),col=col,border=NA,...),
+  "2"=polygon(u[1]+c(0,0,tic,tic,0),u[c(3,4,4,3,3)],col=col,border=NA,...),
+  "3"=polygon(u[c(1,2,2,1,1)],u[4]+c(0,0,-tic,-tic,0),col=col,border=NA,...),
+  "4"=polygon(u[2]+c(0,0,-tic,-tic,0),u[c(3,4,4,3,3)],col=col,border=NA,...))
+ switch(as.character(side),
+  "1"=sapply(x,function(z) lines(c(z,z),u[3]+c(0,tic),col=col.ticks,lwd=lwd)),
+  "2"=sapply(x,function(z) lines(u[1]+c(0,tic),c(z,z),col=col.ticks,lwd=lwd)),
+  "3"=sapply(x,function(z) lines(c(z,z),u[4]+c(0,-tic),col=col.ticks,lwd=lwd)),
+  "4"=sapply(x,function(z) lines(u[2]+c(0,-tic),c(z,z),col=col.ticks,lwd=lwd)))
+ if(ticksize < 0) par(opar)
+ invisible(x)
+}
+
diff --git a/R/size_n_color.R b/R/size_n_color.R
new file mode 100644
index 0000000..b719462
--- /dev/null
+++ b/R/size_n_color.R
@@ -0,0 +1,55 @@
+size_n_color<-function(x=NULL,y,size,sizefun="sqrt",col,main="",
+ xlim=NA,xlab="",xat=NULL,xaxlab=NULL,xcex=1,xlas=0,xgrid=FALSE,
+ ylim=NA,ylab="",yat=NULL,yaxlab=NULL,ycex=1,ylas=1,ygrid=TRUE,
+ mar=c(5,4,4,2),boxit=TRUE,add=FALSE,...) {
+
+ if(!is.na(sizefun)) size<-do.call(sizefun,list(size))
+ if(is.matrix(size)) {
+  dimsize<-dim(size)
+  if(is.null(x)) {
+   x<-matrix(rep((1:dimsize[2])*max(size*2),each=dimsize[1]),ncol=dimsize[2])
+   y<-matrix(rep((dimsize[1]:1)*max(size*2),dimsize[2]),ncol=dimsize[2])
+   if(is.null(xat)) xat<-x[1,]
+   if(is.null(yat)) yat<-y[,1]
+  }
+  else {
+   if(is.null(xat)) xat<-1:dimsize[2]
+   if(is.null(yat)) yat<-1:dimsize[1]
+  }
+ }
+ else {
+  dimsize=c(length(size),1)
+  if(is.null(x)) x<-1:length(size)
+ }
+ xylim<-par("usr")
+ aspect_ratio<-(xylim[2]-xylim[1])/(xylim[4]-xylim[3])
+ maxsize<-max(size)
+ if(is.na(xlim[1]))
+  xlim<-c(min(x)-maxsize*aspect_ratio,max(x)+maxsize*aspect_ratio)
+ if(is.na(ylim[1]))
+  ylim<-c(min(y)-maxsize/aspect_ratio,max(y)+maxsize/aspect_ratio)
+ if(!add) {
+  oldmar<-par(mar=mar)
+  plot(x,y,main=main,xlab=xlab,ylab=ylab,xlim=xlim,ylim=ylim,
+   axes=FALSE,type="n",...)
+  if(xgrid) segments(xat,xylim[3],xat,xylim[4],col="lightgray",lty=2)
+  if(ygrid) segments(xylim[1],yat,xylim[2],yat,col="lightgray",lty=2)
+  axis(1,at=xat,labels=xaxlab,las=xlas,cex.axis=xcex)
+  axis(2,at=yat,labels=yaxlab,las=ylas,cex.axis=ycex)
+  if(boxit) box()
+ }
+ if(is.matrix(size)) {
+  if(is.null(dim(col))) col=matrix(col,nrow=dimsize[1],ncol=dimsize[2])
+  for(row in 1:dimsize[1]) {
+   for(column in 1:dimsize[2])
+    draw.circle(x[row,column],y[row,column],size[row,column],
+     border=NA,col=col[row,column])
+  }
+ }
+ else {
+  if(length(col) < length(size)) col=rep(col,size)
+  for(index in 1:length(size))
+   draw.circle(x[index],y[index],size[index],border=NA,col=col[index])
+ }
+ if(!add) par(mar=oldmar)
+}
diff --git a/R/sizeplot.R b/R/sizeplot.R
new file mode 100755
index 0000000..03fa0ce
--- /dev/null
+++ b/R/sizeplot.R
@@ -0,0 +1,19 @@
+sizeplot<-function(x,y,scale=1,pow=0.5,powscale=TRUE,size=c(1,4),add=FALSE,...) {
+
+ pair <- function(x, y) paste(x, y, sep = "/")
+ unpair <- function(x) t(sapply(strsplit(x, "/"), as.numeric))
+ f<-factor(pair(x, y))
+ n<-table(f)
+ if(min(n) == max(n)) {
+  warning("all points repeated equally (why use sizeplot?)")
+  if(powscale) psize <- rep(length(f), scale)
+  else psize <- rep(length(f), size[1])
+ }
+ else {
+  if(powscale) psize<-scale*n^pow
+  else psize<-size[1]+(size[2]-size[1])*((n-min(n))/(max(n)-min(n)))
+ }
+ newpts<-unpair(levels(f))
+ if(!add) plot(newpts[,1],newpts[,2],cex=psize,type="p",...)
+ else points(newpts[,1],newpts[,2],cex=psize,...)
+}
diff --git a/R/sizetree.R b/R/sizetree.R
new file mode 100755
index 0000000..10c0d33
--- /dev/null
+++ b/R/sizetree.R
@@ -0,0 +1,81 @@
+sizetree<-function(x,left=0,top,right=1,lastcenter=NA,showval=TRUE,
+ showcount=TRUE,stacklabels=TRUE,firstcall=TRUE,col=NULL,border=NA,
+ toplab=NULL,base.cex=1,...) {
+
+ dimx<-dim(x)
+ colname<-names(x)[1]
+ if(firstcall) {
+  x<-x[do.call(order,x),]
+  oldmar<-par("mar")
+  par(mar=c(1,2,2,1))
+  top<-sum(!is.na(x[,1]))
+  if(top<dimx[1]) 
+   cat(dimx[1]-top,"NA values dropped from first stack.\n")
+  plot(0,xlim=c(0,dimx[2]),ylim=c(0,top),type="n", 
+   axes=FALSE,xlab="",ylab="",...)
+ }
+ xfreq<-table(x[,1])
+ lenxf<-length(xfreq)
+ if(firstcall) {
+  if(is.null(col)) {
+   col<-list()
+   for(index in 1:dimx[2])
+    col[[index]]<-rainbow(length(table(x[,index])))
+  }
+  for(index in 1:dimx[2])
+   if(is.null(names(col[[index]])))
+    names(col[[index]])<-names(table(x[,index]))
+ }
+ if(lenxf) {
+  if(is.list(col)) {
+   barcol<-col[[1]]
+   barcol<-barcol[names(col[[1]]) %in% names(xfreq)]
+  }
+  else barcol<-col[names(col) %in% names(xfreq)]
+  labels<-names(xfreq)
+  squeeze<-(right-left)/10
+  for(bar in 1:lenxf) {
+   if(length(xfreq[bar])) {
+    if(!is.na(xfreq[bar])) {
+     if(xfreq[bar] > 0) {
+      rect(left+squeeze,top-xfreq[bar],right-squeeze,top,
+       col=barcol[bar],border=border)
+      labelheight<-strheight(labels[bar])
+      cex<-ifelse((1.5*labelheight) > xfreq[bar], 
+       base.cex*0.75*xfreq[bar]/labelheight,base.cex)
+      if(showval) {
+       textcol<-ifelse(colSums(col2rgb(unlist(barcol[bar])) *
+        c(1.4,1.4,0.5)) < 350,"white","black")
+       bartext<-ifelse(showcount,paste(labels[bar], 
+        " (",xfreq[bar],")",sep=""),labels[bar])
+       text((left+right)/2,top-xfreq[bar]/2, 
+        bartext,cex=cex,col=textcol)
+      }
+      if(!is.na(lastcenter)) 
+       segments(left+squeeze,top-xfreq[bar]/2,left-squeeze,
+        lastcenter)
+      xvalue<-ifelse(is.numeric(x[, 1]),as.numeric(labels[bar]),labels[bar])
+      if(dimx[2] > 1) {
+       newcol<-col
+       newcol[[1]]<-NULL
+       nextx<-subset(x,x[,1]==xvalue,2:dimx[2])
+       sizetree(nextx,right,top,right+1,lastcenter=top-xfreq[bar]/2,
+        showval=showval,firstcall=FALSE,col=newcol,border=border,base.cex=base.cex)
+      }
+     }
+    }
+   }
+   top<-top-xfreq[bar]
+  }
+  if(stacklabels) mtext(colname,side=1,at=(left+right)/2,line=-0.4)
+ }
+ if(firstcall) {
+  if(!is.null(toplab)) {
+   par(xpd=TRUE)
+   top<-sum(!is.na(x[,1]))
+   text(0.5:(dimx[2]+0.5),1.01*top,toplab,adj=c(0.5,0))
+   par(xpd=FALSE)
+  }
+  par(mar=oldmar)
+ }
+}
diff --git a/R/smoothColors.R b/R/smoothColors.R
new file mode 100755
index 0000000..1065df7
--- /dev/null
+++ b/R/smoothColors.R
@@ -0,0 +1,53 @@
+smoothColors<-function(...,alpha=NA){
+ args <- list(...)
+ r <- g <- b <- NULL
+ while(length(args) > 0) {
+  if(!is.character(args[[1]]))
+   stop("Usage: smoothColors(\"color name\",[n|\"color name\"],...,\"color name\")")
+  arglen<-length(args)
+  if(arglen > 1){
+   if(is.numeric(args[[2]])){
+    lastarg<-2
+    # args[[lastarg]] should be a color name
+    while(is.numeric(args[[lastarg]])) {
+     lastarg<-lastarg+1
+     # make sure that there are enough arguments left
+     if(lastarg > arglen) stop("bad argument list")
+    } 
+    ## do interpolate:
+    from <- col2rgb(args[[1]])
+    too <- col2rgb(args[[lastarg]])
+    ## generate args[[2]] colors between specified colors:
+    n <- args[[2]]+2 # add 2 for start and finish
+    ## chop off last one since it will be added on the next iteration:
+    r <- c(r,seq(from[1,],too[1,],length=n))
+    i <- length(r)
+    r <- r[-i]
+    g <- c(g,seq(from[2,],too[2,],length=n))
+    g <- g[-i]
+    b <- c(b,seq(from[3,],too[3,],length=n))
+    b <- b[-i]
+    ## cut color and n from list and back we go
+    args <- args[-(1:(lastarg-1))]
+   }
+   else {
+    ## insert color, chop off 1
+    cc <- col2rgb(args[[1]])
+    r <- c(r,cc[1,])
+    g <- c(g,cc[2,])
+    b <- c(b,cc[3,])
+    args <- args[-1]
+   }
+  }
+  else {
+   ## insert color, chop off 1
+   cc <- col2rgb(args[[1]])
+   r <- c(r,cc[1,])
+   g <- c(g,cc[2,])
+   b <- c(b,cc[3,])
+   args <- args[-1]
+  }
+ }
+ if(is.na(alpha)) rgb(r,g,b,maxColorValue=255)
+ else rgb(r,g,b,alpha=alpha,maxColorValue=255)
+}
diff --git a/R/soil.texture.R b/R/soil.texture.R
new file mode 100755
index 0000000..e9d1097
--- /dev/null
+++ b/R/soil.texture.R
@@ -0,0 +1,48 @@
+get.soil.texture<-function(use.percentages=FALSE,cnames=c("sand","silt","clay")) {
+ return(get.triprop(use.percentages=use.percentages, cnames=cnames))
+}
+
+soil.texture<-function(soiltexture=NULL,main="",at=seq(0.1,0.9,by=0.1),
+ axis.labels=c("percent sand","percent silt","percent clay"),
+ tick.labels=list(l=seq(10,90,by=10),r=seq(10,90,by=10),b=seq(10,90,by=10)),
+ show.names=TRUE,show.lines=TRUE,col.names="gray",bg.names=par("bg"),
+ show.grid=FALSE,col.axis="black",col.lines="gray",col.grid="gray",
+ lty.grid=3,show.legend=FALSE,label.points=FALSE,point.labels=NULL,
+ col.symbols="black",pch=par("pch"), ...) {
+
+ par(xpd=TRUE)
+ plot(0.5,type="n",axes=FALSE,xlim=c(0,1),ylim=c(0,1),main=NA,xlab=NA, ylab=NA)
+ triax.plot(x=NULL,main=main,at=at,axis.labels=axis.labels,tick.labels=tick.labels,
+  col.axis=col.axis,show.grid=show.grid,col.grid=col.grid,lty.grid=lty.grid)
+ arrows(0.12,0.41,0.22,0.57,length=0.15)
+ arrows(0.78,0.57,0.88,0.41,length=0.15)
+ arrows(0.6,-0.1,0.38,-0.1,length=0.15)
+ if(show.lines) {
+  triax.segments<-function(h1,h3,t1,t3,col) {
+   segments(1-h1-h3/2,h3*sin(pi/3),1-t1-t3/2,t3*sin(pi/3),col=col)
+  }
+  # from bottom-left to up
+  h1 <- c(85, 70, 80, 52, 52, 50, 20,  8, 52, 45, 45, 65, 45, 20, 20)/100
+  h3 <- c( 0,  0, 20, 20,  7,  0,  0, 12, 20, 27, 27, 35, 40, 27, 40)/100
+  t1 <- c(90, 85, 52, 52, 43, 23,  8,  0, 45,  0, 45, 45,  0, 20,  0)/100
+  t3 <- c(10, 15, 20,  7,  7, 27, 12, 12, 27, 27, 55, 35, 40, 40, 60)/100
+  triax.segments(h1, h3, t1, t3, col.lines)
+ }
+ if(show.names) {
+  xpos <- c(0.5, 0.7, 0.7, 0.73, 0.73, 0.5, 0.275, 0.275, 0.27,
+   0.27, 0.25, 0.135, 0.18, 0.055, 0.49, 0.72, 0.9)
+  ypos <- c(0.66, 0.49, 0.44, 0.36, 0.32, 0.35, 0.43, 0.39, 0.3,
+   0.26, 0.13, 0.072, 0.032, 0.024, 0.18, 0.15, 0.06)*sin(pi/3)
+  snames <- c("clay", "silty", "clay", "silty clay", "loam",
+   "clay loam", "sandy", "clay", "sandy clay", "loam", "sandy loam",
+   "loamy", "sand", "sand", "loam", "silt loam", "silt")
+  boxed.labels(xpos, ypos, snames, border=FALSE, xpad=0.5)
+ }
+ par(xpd=FALSE)
+ # now call triax.points
+ if(is.null(soiltexture)) return(NULL)
+ soilpoints <- triax.points(soiltexture, show.legend=show.legend,
+  label.points=label.points, point.labels=point.labels,
+  col.symbols=col.symbols, pch=pch, ...)
+ invisible(soilpoints)
+}
diff --git a/R/soil.texture.uk.R b/R/soil.texture.uk.R
new file mode 100755
index 0000000..7422d1a
--- /dev/null
+++ b/R/soil.texture.uk.R
@@ -0,0 +1,49 @@
+# UK soil texture plot
+soil.texture.uk <- function (soiltexture = NULL, main = "",
+ at = seq(0.1, 0.9, by = 0.1),
+ axis.labels = c("percent sand", "percent silt", "percent clay"),
+ tick.labels = list(l = seq(10, 90, by = 10), r = seq(10, 90, by = 10),
+ b = seq(10, 90, by = 10)), show.names = TRUE,
+ show.lines = TRUE, col.names = "gray", bg.names = par("bg"),
+ show.grid = FALSE, col.axis = "black", col.lines = "gray",
+ col.grid = "gray", lty.grid = 3, show.legend = FALSE, label.points = FALSE,
+ point.labels = NULL, col.symbols = "black", pch = par("pch"),
+ h1 = NA, h3 = NA, t1 = NA, t3 = NA, lwduk = 2, xpos = NA, ypos = NA,
+ snames = NA, cexuk = 1.1, ...) {
+ 
+ if(is.na(h1[1])) h1<-c(82, 85, 70, 50, 45, 20) / 100
+ if(is.na(h3[1])) h3<-c(18, 15, 30, 30, 35, 0) / 100
+ if(is.na(t1[1])) t1<-c(0, 70, 50, 45, 0, 20) / 100
+ if(is.na(t3[1])) t3<-c(18, 0, 30, 35, 35, 35) / 100
+ # Name positions (x and y, x starting form left point)
+ if(is.na(xpos[1])) xpos<-c(0.5,0.77,0.45,0.1,0.45,0.85)
+ if(is.na(ypos[1])) ypos<-c(0.65,0.265,0.265,0.07,0.1,0.1)
+ if(is.na(snames[1])) snames <- c("Clays","Medium silts","Medium loams",
+  "Sands","Light loams","Light silts")
+ par(xpd = TRUE)
+ plot(0.5, type = "n", axes = FALSE, xlim = c(0,1),ylim = c(0,1),
+  main = NA, xlab = NA, ylab = NA)
+ triax.plot(x=NULL,main = main, at = at, axis.labels = axis.labels,
+  tick.labels = tick.labels, col.axis = col.axis, show.grid = show.grid,
+   col.grid = col.grid, lty.grid = lty.grid)
+ arrows(0.12, 0.41, 0.22, 0.57, length = 0.15)
+ arrows(0.78, 0.57, 0.88, 0.41, length = 0.15)
+ arrows(0.6, -0.1, 0.38, -0.1, length = 0.15)
+ if(show.lines) {
+  triax.segments <- function(h1, h3, t1, t3, col, lwd) {
+   segments(1 - h1 - h3/2, h3 * sin(pi/3), 1 - t1 -
+   t3/2, t3 * sin(pi/3), col = col, lwd = lwd)
+  }
+  triax.segments(h1 , h3, t1, t3, col.lines, lwduk)
+ }
+ if (show.names) {
+  boxed.labels(xpos, ypos* sin(pi/3), snames, border = FALSE,
+  xpad = 0.5, cex = cexuk)
+ }
+ par(xpd = FALSE)
+ if (is.null(soiltexture)) return(NULL)
+ soilpoints <- triax.points(soiltexture, show.legend = show.legend,
+  label.points = label.points, point.labels = point.labels,
+  col.symbols = col.symbols, pch = pch, ...)
+ invisible(soilpoints)
+}
diff --git a/R/spread.labels.R b/R/spread.labels.R
new file mode 100755
index 0000000..f3032e0
--- /dev/null
+++ b/R/spread.labels.R
@@ -0,0 +1,71 @@
+spread.labels<-function (x,y,labels=NULL,ony=NA,offsets=NA,between=FALSE,
+ linecol=par("fg"),srt=0,...) {
+
+ if(missing(x)) 
+  stop("Usage: spread.labels(x,y,labels,...)")
+ nx<-length(x)
+ ny<-length(y)
+ if(is.na(ony)) {
+  xylim<-par("usr")
+  ony<-diff(range(x))/(xylim[2]-xylim[1])<diff(range(y))/(xylim[4]-xylim[3])
+ }
+ if(between) {
+  if(length(linecol)==1) linecol<-rep(linecol,2)
+  nlabels<-length(labels)
+  if(ony) {
+   newy<-seq(y[1],y[ny],length=nlabels)
+   # put the labels in the middle
+   labelx<-rep(mean(x),nlabels)
+   # do the left lines
+   segments(x[1:nlabels],y[1:nlabels],labelx-strwidth(labels)/2,newy,
+    col=linecol[1])
+   # now the right lines
+   segments(x[(nlabels+1):ny],y[(nlabels+1):ny],labelx+strwidth(labels)/2,newy,
+    col=linecol[2])
+   text(labelx,newy,labels,srt=srt,...)
+  }
+  else {
+   newx<-seq(x[1],x[nx],length=nlabels)
+   # put the labels in the middle
+   labely<-rep(mean(y),nlabels)
+   # do the upper lines
+   segments(x[1:nlabels],y[1:nlabels],newx+strheight(labels)/2,labely,
+    col=linecol[1])
+   # now the right lines
+   #segments(x[(nlabels+1):ny],y[(nlabels+1):ny],labelx+strwidth(labels)/2,newy,
+    #col=linecol[2])
+   text(newx,labely,labels,srt=srt,...)
+  }
+ }
+ else {
+  if(ony) {
+   sort.index<-sort.list(y)
+   x<-x[sort.index]
+   y<-y[sort.index]
+   newy<-seq(y[1],y[ny],length=length(labels))
+   if(is.na(offsets)) {
+    offset<-diff(par("usr")[1:2])/4
+    offsets<-rep(c(offset,-offset),ny/2+1)[1:ny]
+   }
+   segments(x+offsets,newy,x,y)
+   text(x+offsets,newy,labels[sort.index],srt=srt,pos=c(4,2),...)
+  }
+  else {
+   sort.index<-sort.list(x)
+   x<-x[sort.index]
+   y<-y[sort.index]
+   nx<-length(x)
+   newx <- seq(x[1],x[nx],length=length(labels))
+   if(missing(offsets)) {
+    offset<-diff(par("usr")[3:4])/4
+    offsets<-rep(c(offset,-offset),nx/2+1)[1:nx]
+   }
+   text(newx,y+offsets,labels[sort.index],srt=srt,...)
+   seggap<-strheight("M")*2
+   if(all(offsets > 0) || all(offsets < 0))
+    seggaps<-rep(seggap*(all(offsets)<0)*-1,length.out=nx)
+   else seggaps<-rep(c(seggap,-seggap),length.out=nx)
+   segments(newx,y+offsets-seggaps,x,y)
+  }
+ }
+}
diff --git a/R/spreadout.R b/R/spreadout.R
new file mode 100755
index 0000000..f343f53
--- /dev/null
+++ b/R/spreadout.R
@@ -0,0 +1,54 @@
+spreadout<-function(x,mindist) {
+ if(sum(!is.na(x)) < 2) return(x)
+ xorder<-order(x)
+ goodx<-x[xorder][!is.na(x[xorder])]
+ gxlen<-length(goodx)
+ start<-end<-gxlen%/%2
+ # nicely spread groups of short intervals apart from their mean
+ while(start > 0) {
+  while(end < gxlen && goodx[end+1] - goodx[end] < mindist) end<-end+1
+  while(start > 1 && goodx[start] - goodx[start-1] < mindist) start<-start-1
+  if(start < end) {
+   nsqueezed<-1+end-start
+   newx<-sum(goodx[start:end])/nsqueezed -
+    mindist*(nsqueezed%/%2 - (nsqueezed/2 == nsqueezed%/%2) * 0.5)
+   for(stretch in start:end) {
+    goodx[stretch]<-newx
+    newx<-newx+mindist
+   }
+  }
+  start<-end<-start-1
+ }
+ start<-end<-length(goodx)%/%2+1
+ while(start < gxlen) {
+  while(start > 1 && goodx[start] - goodx[start-1] < mindist) start<-start-1
+  while(end < gxlen && goodx[end+1] - goodx[end] < mindist) end<-end+1
+  if(start < end) {
+   nsqueezed<-1+end-start
+   newx<-sum(goodx[start:end])/nsqueezed -
+    mindist*(nsqueezed%/%2 - (nsqueezed/2 == nsqueezed%/%2) * 0.5)
+   for(stretch in start:end) {
+    goodx[stretch]<-newx
+    newx<-newx+mindist
+   }
+  }
+  start<-end<-end+1
+ }
+ # force any remaining short intervals apart
+ if(any(diff(goodx) < mindist)) {
+  start<-gxlen%/%2
+  while(start > 1) {
+   if(goodx[start] - goodx[start-1] < mindist)
+    goodx[start-1]<-goodx[start]-mindist
+   start<-start-1
+  }
+  end<-gxlen%/%2
+  while(end < gxlen) {
+   if(goodx[end+1] - goodx[end] < mindist)
+    goodx[end+1]<-goodx[end]+mindist
+   end<-end+1
+  }
+ }
+ x[xorder][!is.na(x[xorder])]<-goodx
+ return(x)
+}
diff --git a/R/stackpoly.R b/R/stackpoly.R
new file mode 100755
index 0000000..ea7c7b5
--- /dev/null
+++ b/R/stackpoly.R
@@ -0,0 +1,54 @@
+stackpoly<-function(x,y=NULL,main="",xlab="",ylab="",xat=NA,xaxlab=NA,
+ xlim=NA,ylim=NA,lty=1,lwd=1,border=NA,col=NULL,staxx=FALSE,stack=FALSE,
+ axis2=TRUE,axis4=TRUE,padj=0,...) {
+
+ ydim<-dim(y)
+ if(is.null(y[1])) {
+  y<-x
+  ydim<-dim(y)
+  if(is.null(ydim)) x<-1:length(y)
+  else x<-matrix(rep(1:ydim[1],ydim[2]),ncol=ydim[2])
+ }
+ # fix when x is a vector and y a matrix - Phil Novack-Gottshall
+ if(!identical(dim(x),ydim)) x<-matrix(rep(x,ydim[2]),ncol=ydim[2])
+ if(stack) y<-t(unlist(apply(as.matrix(y),1,cumsum)))
+ if(is.na(xlim[1])) xlim<-range(x)
+ if(is.na(ylim[1])) ylim<-range(y)
+ plot(0,main=main,xlab=xlab,ylab=ylab,xlim=xlim,ylim=ylim,type="n",
+  xaxs="i",yaxs="i",axes=FALSE,...)
+ if(is.matrix(y) || is.list(y)) {
+  plotlim<-par("usr")
+  if(is.na(xat[1])) xat<-x[,1]
+  if(is.na(xaxlab[1])) xaxlab<-xat
+  if(staxx) staxlab(at=xat,labels=xaxlab)
+  else axis(1,at=xat,labels=xaxlab,padj=padj)
+  if(axis2) axis(2)
+  if(axis4) axis(4)
+  if(is.null(col[1])) col=rainbow(ydim[2])
+  else if(length(col)<ydim[2]) col<-rep(col,length.out=ydim[2])
+  if(length(border) < ydim[2]) border<-rep(border,length.out=ydim[2])
+  if(length(lty)<ydim[2]) lty<-rep(lty,length.out=ydim[2])
+  if(length(lwd)<ydim[2]) lwd<-rep(lwd,length.out=ydim[2])
+  for(pline in seq(ydim[2],1,by=-1)) {
+   if(pline==1) {
+    polygon(c(x[1],x[,pline],x[ydim[1]]),
+     c(plotlim[3],y[,pline],plotlim[3]),
+     border=border[pline],col=col[pline],lty=lty[pline],lwd=lwd[pline])
+   }
+   else
+    polygon(c(x[,pline],rev(x[,pline-1])),c(y[,pline],rev(y[,pline-1])),
+     border=border[pline],col=col[pline],lty=lty[pline],lwd=lwd[pline])
+  }
+ }
+ else {
+  polygon(c(min(x),x,max(x),0),c(0,y,0,0),border=border,col=col,lty=lty,
+   lwd=lwd)
+  if(is.na(xat[1])) xat<-x
+  if(is.na(xaxlab[1])) xaxlab<-xat
+  if(staxx) staxlab(at=xat,labels=xaxlab)
+  else axis(1,at=xat,labels=xaxlab)
+  if(axis2) axis(2)
+  if(axis4) axis(4)
+ }
+ box()
+}
diff --git a/R/staircase.plot.R b/R/staircase.plot.R
new file mode 100755
index 0000000..e63223a
--- /dev/null
+++ b/R/staircase.plot.R
@@ -0,0 +1,120 @@
+staircase.plot<-function(heights,totals=NA,labels=NULL,halfwidth=0.3,main="",
+ mar=NA,total.col="blue",inc.col=NA,bg.col=NA,direction="e",las=1,
+ display.height=TRUE,stagger=FALSE,cex=par("cex"),prefix="",suffix="",...) {
+
+ staircasePlot(heights=heights,totals=totals,labels=labels,halfwidth=halfwidth,
+ main=main,mar=mar,stair.info=list(total.col=total.col,inc.col=inc.col,
+ border=par("fg")),bg.col=bg.col,direction=direction,las=las,
+ display.height=display.height,stagger=stagger,cex=cex,prefix=prefix,
+ suffix=suffix,...)
+}
+
+staircasePlot<-function(heights,totals=NA,labels=NULL,halfwidth=0.3,main="",
+ mar=NA,stair.info=list(total.col="blue",inc.col=NA,border=par("fg")),
+ bg.col=NA,direction="e",las=1,display.height=TRUE,stagger=FALSE,cex=par("cex"),
+ prefix="",suffix="",...) {
+
+ if(is.matrix(heights) | is.data.frame(heights)) {
+  dimheights<-dim(heights)
+  if(dimheights[2] > 1) totals<-heights[,2]
+  heights<-as.vector(heights)
+ }
+ if(!is.numeric(heights))
+  stop("heights must be a numeric vector or matrix/data frame with numeric first column")
+ nbars<-length(heights)
+ if(length(prefix) < nbars) prefix<-rep(prefix,length.out=nbars)
+ if(length(suffix) < nbars) suffix<-rep(suffix,length.out=nbars)
+ # if no marker for increments (FALSE | 0) and totals (TRUE | non-zero)
+ # consider the first and last values to be totals and all others increments 
+ if(is.na(totals[1])) totals<-c(TRUE,rep(FALSE,nbars-2),TRUE)
+ # coerce totals to a logical vector if it isn't
+ if(!is.logical(totals)) totals<-totals != 0
+ oldmar<-par("mar")
+ if(!is.na(bg.col)) {
+  oldbg<-par("bg")
+  par(bg=bg.col)
+ }
+ maxht<-max(heights)
+ # if there is a negative total height, make that the minimum, otherwise zero
+ minht<-min(c(min(heights[totals]),0))
+ currht<-heights[1]
+ for(i in 2:nbars) {
+  if(!totals[i]) {
+   currht<-currht+heights[i]
+   if(currht > maxht) maxht<-currht
+  }
+ }
+ if(direction == "e" || direction == "w") {
+  if(is.na(mar[1])) mar<-c(10,2,3,2)
+  par(mar=mar,xaxs="i")
+  plot(0,xlim=c(0.5,nbars+0.5),ylim=c(minht,maxht),type="n",axes=FALSE,
+   xlab="",ylab="",...)
+ }
+ else {
+  if(is.na(mar[1])) mar<-c(2,10,3,2)
+  par(mar=mar,yaxs="i")
+  plot(0,xlim=c(minht,maxht),ylim=c(0.5,nbars+0.5),type="n",axes=FALSE,
+   xlab="",ylab="",...)
+ }
+ par(xpd=TRUE)
+ bar.col<-rep(NA,nbars)
+ if(length(stair.info$inc.col) < sum(!totals))
+  stair.info$inc.col=rep(stair.info$inc.col,length.out=sum(!totals))
+ bar.col[!totals]<-stair.info$inc.col
+ bar.col[totals]<-stair.info$total.col
+ label_offset<-ifelse(direction == "e" || direction == "w",
+  strheight("M"),strwidth("M"))
+ if(direction == "s" || direction == "w") {
+  start<-nbars
+  finish<-1
+  dir<- -1
+ }
+ else {
+  start<-1
+  finish<-nbars
+  dir<-1
+ }
+ barend<-0
+ barpos<-start:finish
+ for(bar in 1:nbars) {
+  barstart<-ifelse(totals[bar],0,barend)
+  barend<-barstart+heights[bar]
+  if(direction == "e" || direction == "w") {
+   rect(barpos[bar]-halfwidth,barstart,barpos[bar]+halfwidth,barend,
+    col=bar.col[bar],border=stair.info$border)
+   if(display.height)
+    text(barpos[bar],ifelse(heights[bar]<0,barstart,barend)+label_offset,
+     paste(prefix[bar],heights[bar],suffix[bar],sep=""),cex=cex)
+   if(direction == "e" && bar != nbars)
+    segments(barpos[bar]+halfwidth*dir,barend,barpos[bar]+dir-halfwidth*dir,
+     barend,lty=3)
+   if(direction == "w" && bar != nbars)
+    segments(barpos[bar]-halfwidth*dir,barend,barpos[bar]+dir+halfwidth*dir,
+     barend,lty=3)
+   if(!is.null(labels)) {
+    labelline<-0.2
+    if(stagger) labelline<-c(labelline,1.2)
+    mtext(labels,side=1,line=labelline,at=start:finish,adj=0.5,padj=1,
+     las=las,cex=cex)
+   }
+  }
+  else {
+   rect(barstart,barpos[bar]-halfwidth,barend,barpos[bar]+halfwidth,
+    col=bar.col[bar])
+   if(display.height)
+    text(ifelse(heights[bar]<0,barstart,barend)+label_offset,
+     barpos[bar],paste(prefix[bar],heights[bar],suffix[bar],sep=""),adj=0,cex=cex)
+   if(bar != nbars)
+    segments(barend,barpos[bar]+halfwidth*dir,barend,
+     barpos[bar]+dir-halfwidth*dir,lty=3)
+   if(!is.null(labels)) {
+    labelline<-0.5
+    if(stagger) labelline<-c(labelline,1.5)
+    mtext(labels,side=2,line=labelline,at=start:finish,adj=1,las=las,cex=cex)
+   }
+  }
+ }
+ if(nchar(main)) mtext(main,line=mar[3]/2,at=getFigCtr()[1],cex=1.5)
+ par(xpd=FALSE,mar=oldmar)
+ if(!is.na(bg.col)) par(bg=oldbg)
+}
diff --git a/R/starPie.R b/R/starPie.R
new file mode 100644
index 0000000..97665c5
--- /dev/null
+++ b/R/starPie.R
@@ -0,0 +1,43 @@
+starPie<-function(x,y,radext,values,maxval=NA,border=par("fg"),col=NA,
+ prop.area=FALSE,label="",labelpos=1) {
+
+ valdim<-dim(values)
+ if(is.null(valdim)) {
+  npies<-1
+  values<-matrix(values,nrow=1)
+  valdim<-dim(values)
+ }
+ nfaces<-valdim[2]
+ if(is.na(x[1])) x<-rep(1:valdim[1],valdim[2])
+ if(is.na(y[1])) y<-rep(1:valdim[2],each=valdim[1])
+ if(length(labelpos) < valdim[1])
+  labelpos<-rep(labelpos,length.out=valdim[1]*valdim[2])
+ if(is.na(col[1])) col<-rainbow(nfaces)
+ if(length(col)<nfaces) col<-rep(col,length.out=nfaces)
+ if(is.na(maxval)) maxval<-max(values)
+ # get the y adjustment
+ ymult<-getYmult()
+ if(prop.area) values<-sqrt(values)
+ for(spie in 1:valdim[1]) {
+  angles<-5*pi/2-seq(0,pi*2,length.out=nfaces+1)
+  # for proportional area sectors, use the square root 
+  # adjust the maximum value to the radius
+  facerad<-radext*values[spie,]/maxval
+  for(face in 1:nfaces) {
+   xpos<-c(x[spie]+cos(angles[face])*facerad[face],x[spie],
+    x[spie]+cos(angles[face+1])*facerad[face])
+   ypos<-c(y[spie]+sin(angles[face])*facerad[face]*ymult,y[spie],
+    y[spie]+sin(angles[face+1])*facerad[face]*ymult)
+   polygon(xpos,ypos,col=col[face])
+   segments(x[spie],y[spie],x[spie]+cos(angles[face])*radext,
+    y[spie]+sin(angles[face])*radext*ymult)
+  }
+  if(nchar(label[spie])) {
+   x[spie]<-ifelse(labelpos[spie]%%2,x[spie],x[spie]+radext*(labelpos[spie]-3))
+   y[spie]<-ifelse(labelpos[spie]%%2,y[spie]+radext*(labelpos[spie]-2),y[spie])
+   hadj<-ifelse(labelpos[spie]%%2,0.5,labelpos[spie]==2)
+   vadj<-ifelse(labelpos[spie]%%2,labelpos[spie]==3,0.5)
+   text(x[spie],y[spie],label[spie],adj=c(hadj,vadj))
+  }
+ }
+}
diff --git a/R/staxlab.R b/R/staxlab.R
new file mode 100755
index 0000000..de20de9
--- /dev/null
+++ b/R/staxlab.R
@@ -0,0 +1,47 @@
+# staxlab produces staggered axis tick labels
+# note that barplot() tends to mess things up by plotting an X axis 
+# even when axes=FALSE
+
+staxlab<-function(side=1,at,labels,nlines=2,top.line=0.5,
+ line.spacing=0.8,srt=NA,ticklen=0.03,adj=1,...) {
+
+ if(missing(labels)) labels<-at
+ nlabels<-length(labels)
+ if(missing(at)) at<-1:nlabels
+ axislim<-par("usr")[3:4-2*side%%2]
+ if(any(at < axislim[1]) || any(at > axislim[2]))
+  warning("Some axis labels are off the plot")
+ if(is.na(srt)) {
+  linepos<-rep(top.line,nlines)
+  for(i in 2:nlines) linepos[i]<-linepos[i-1]+line.spacing
+  linepos<-rep(linepos,ceiling(nlabels/nlines))[1:nlabels]
+  axis(side=side,at=at,labels=rep("",nlabels))
+  mtext(text=labels,side=side,line=linepos,at=at,...)
+ }
+ else {
+  xylim<-par("usr")
+  if(side == 1) {
+   xpos<-at
+   if(par("ylog")) ypos<-10^(xylim[3]-ticklen*(xylim[4]-xylim[3]))
+   else ypos<-xylim[3]-ticklen*(xylim[4]-xylim[3])
+  }
+  if(side == 3) {
+   xpos<-at
+   if(par("ylog")) ypos<-10^(xylim[4]+ticklen*(xylim[4]-xylim[3]))
+   else ypos<-xylim[4]+ticklen*(xylim[4]-xylim[3])
+  }
+  if(side == 2) {
+   ypos<-at
+   if(par("xlog")) xpos<-10^(xylim[1]-ticklen*(xylim[2]-xylim[1]))
+   else xpos<-xylim[1]-ticklen*(xylim[2]-xylim[1])
+  }
+  if(side == 4) {
+   ypos<-at
+   if(par("xlog")) xpos<-10^(xylim[2]+ticklen*(xylim[2]-xylim[1]))
+   else xpos<-xylim[2]+ticklen*(xylim[2]-xylim[1])
+  }
+  par(xpd=TRUE)
+  text(xpos,ypos,labels,srt=srt,adj=adj,...)
+  par(xpd=FALSE)
+ }
+}
diff --git a/R/std.error.R b/R/std.error.R
new file mode 100755
index 0000000..88da00c
--- /dev/null
+++ b/R/std.error.R
@@ -0,0 +1,19 @@
+std.error<-function(x,na.rm) {
+ vn<-function(x) return(sum(!is.na(x)))
+ dimx<-dim(x)
+ if(is.null(dimx)) {
+  stderr<-sd(x,na.rm=TRUE)
+  vnx<-vn(x)
+ }
+ else {
+  if(is.data.frame(x)) {
+   vnx<-unlist(sapply(x,vn))
+   stderr<-unlist(sapply(x,sd,na.rm=TRUE))
+  }
+  else {
+   vnx<-unlist(apply(x,2,vn))
+   stderr<-unlist(apply(x,2,sd,na.rm=TRUE))
+  }
+ }
+ return(stderr/sqrt(vnx))  
+}
diff --git a/R/symbolbarplot.R b/R/symbolbarplot.R
new file mode 100755
index 0000000..1dff803
--- /dev/null
+++ b/R/symbolbarplot.R
@@ -0,0 +1,97 @@
+symbolbarplot<-function(height,width=1,space=NULL,names.arg=NULL,
+ legend.text=NULL,beside=FALSE,horiz=FALSE,col=heat.colors(NR),
+ border=par("fg"),main=NULL,sub=NULL,xlab=NULL,ylab=NULL,
+ xlim=NULL,ylim=NULL,axes=TRUE,axisnames=TRUE,inside=TRUE,
+ plot=TRUE,rel.width=0.8,symbol="circles",symbbox=TRUE,debug=FALSE,...) {
+    
+ if(!missing(inside)) .NotYetUsed("inside", error = FALSE)
+ if(!missing(border)) .NotYetUsed("border", error = FALSE)
+ if(missing(space))
+  space<-if(is.matrix(height) && beside) c(0, 1) else 0.2
+  space<-space*mean(width)
+  if(plot && axisnames && missing(names.arg))
+   names.arg<-if (is.matrix(height)) colnames(height) else names(height)
+  if(is.vector(height)) {
+   height <- cbind(height)
+   beside <- TRUE
+  }
+  else {
+   if(is.array(height) && (length(dim(height)) == 1)) {
+    height <- rbind(height)
+    beside <- TRUE
+   }
+   else if(!is.matrix(height)) stop("`height' must be a vector or a matrix")
+  }
+  NR <- nrow(height)
+  NC <- ncol(height)
+  if(beside) {
+   if(length(space) == 2)
+    space <- rep(c(space[2],rep(space[1],NR - 1)),NC)
+    width <- rep(width,length = NR * NC)
+   }
+   else {
+    width <- rep(width,length = NC)
+    height <- rbind(0,apply(height,2,cumsum))
+   }
+   delta <- width/2
+   w.r <- cumsum(space + width)
+   w.m <- w.r - delta
+   w.l <- w.m - delta
+   if(horiz) {
+    if(missing(xlim)) xlim <- range(-0.01 * height, height)
+    if(missing(ylim)) ylim <- c(min(w.l), max(w.r))
+   }
+   else {
+    if(missing(xlim)) xlim <- c(min(w.l), max(w.r))
+    if(missing(ylim)) ylim <- range(-0.01 * height, height)
+   }
+   if(beside) w.m <- matrix(w.m, ncol = NC)
+   if(plot) {
+    opar<-
+     if (horiz) par(xaxs = "i", xpd = TRUE)
+     else par(yaxs = "i", xpd = TRUE)
+    on.exit(par(opar))
+    plot.new()
+    plot.window(xlim, ylim, log = "", ...)
+    xyrect<-function(x1,y1,x2,y2,horizontal = TRUE,n,col,...) {
+     if(horizontal)
+      multsymbolbox(x1, y1, x2, y2, tot = x2 - x1,
+       bg = col, fg = col, relw = rel.width, box = symbbox,
+       debug = debug, ...)
+     else
+      multsymbolbox(y1, x1, y2, x2, tot = x2 - x1,
+       bg = col, fg = col, relw = rel.width, box = symbbox,
+       debug = debug, ...)
+    }
+    if(beside) xyrect(0,w.l,c(height),w.r,horizontal=horiz,col=col,n=c(height))
+    else {
+     for (i in 1:NC) {
+      xyrect(height[1:NR, i], w.l[i], height[-1, i],
+       w.r[i], horizontal = horiz, col = col, n = height[1:NR,i])
+     }
+    }
+    if(axisnames && !is.null(names.arg)) {
+     at.l<-
+      if(length(names.arg) != length(w.m)) {
+       if(length(names.arg) == NC) apply(w.m, 2, mean)
+       else stop("incorrect number of names")
+      }
+      else w.m
+       axis(if(horiz) 2 else 1,at=at.l,labels=names.arg,lty = 0)
+    }
+    if(!is.null(legend.text)) {
+     legend.col <- rep(col, length = length(legend.text))
+     if ((horiz & beside) || (!horiz & !beside)) {
+      legend.text <- rev(legend.text)
+      legend.col <- rev(legend.col)
+     }
+     xy<-par("usr")
+     legend(xy[2] - xinch(0.1), xy[4] - yinch(0.1), legend = legend.text,
+      fill = legend.col, xjust = 1, yjust = 1)
+    }
+    title(main = main,sub = sub,xlab = xlab,ylab = ylab,...)
+    if(axes) axis(if(horiz) 1 else 2)
+    invisible(w.m)
+   }
+   else w.m
+}
diff --git a/R/symbolbox.R b/R/symbolbox.R
new file mode 100755
index 0000000..138981f
--- /dev/null
+++ b/R/symbolbox.R
@@ -0,0 +1,39 @@
+symbolbox<-function(x1,y1,x2,y2,tot,relw=0.5,fg=par("fg"),bg=par("bg"),
+ box=TRUE,debug=TRUE,...) {
+
+ if(debug) cat("symbolbox:",x1,y1,x2,y2,tot,"\n")
+  x <- c(x1,x2)
+  y <- c(y1,y2)
+  if (x2 < x1) x<-rev(x)
+  if (y2 < y1) y<-rev(y)
+  pin<-par("pin")
+  usr<-par("usr")
+  usr.pin<-diff(par("usr"))[c(1,3)]/par("pin")
+  dx<-diff(x)/usr.pin[1]
+  dy<-diff(y)/usr.pin[2]
+  area<-dx*dy
+  m<-dx*sqrt(tot/area)
+  n<-dy*sqrt(tot/area)
+  rm<-max(round(m),1)
+  rn<-max(round(n),1)
+  while(rm*rn < tot) {
+   if((dx*sqrt(tot/area)-m) > (dy*sqrt(tot/area)-n)) {
+    rm <- rm + 1
+   }
+   else {
+    rn <- rn + 1
+   }
+  }
+  m<-rm
+  n<-rn
+  if(debug) cat("symbolbox:",dx,dy,m,n,rm,rn,tot,"\n")
+  r<-dx/m*relw/2
+  dx<-dx/m*usr.pin[1]
+  dy<-dy/n*usr.pin[2]
+  mat<-matrix(1:(m*n),nrow=m,ncol=n)
+  xpos<-x[1]+(row(mat)[mat <= tot] - 0.5) * dx
+  ypos<-y[1]+(col(mat)[mat <= tot] - 0.5) * dy
+  symbols(xpos,ypos,rep(1,tot),bg=bg,fg=fg,add=TRUE,inches=r)
+  if(box)
+   polygon(x[c(1,1,2,2,1)],y[c(1,2,2,1,1)],border=fg,...)
+}
diff --git a/R/tab.title.R b/R/tab.title.R
new file mode 100755
index 0000000..ed2dd7b
--- /dev/null
+++ b/R/tab.title.R
@@ -0,0 +1,41 @@
+tab.title<-function(label,text.col=par("fg"),tab.col=par("bg"),
+ border=par("fg"),lwd=par("lwd"),cex=1.5,pad.mult=1.6,radius=0) {
+
+ plotin<-par("pin")
+ marin<-par("mai")
+ plim<-par("usr")
+ xmult<-(plim[2]-plim[1])/(plim[4]-plim[3])*plotin[2]/plotin[1]
+ plim[3]<-plim[4]
+ plim[4]<-plim[3]+((plim[2]-plim[1])/xmult)*marin[3]/plotin[2]
+ oldcex<-par("cex")
+ par(cex=cex)
+ tabtop<-plim[3]+strheight(label)*pad.mult
+ oldxlog<-par("xlog")
+ oldylog<-par("ylog")
+ par(xlog=FALSE,ylog=FALSE)
+ if(radius == 0) {
+  tabx<-c(plim[1],plim[1],plim[2],plim[2])
+  taby<-c(plim[3],tabtop,tabtop,plim[3])
+ }
+ else {
+  xradius<-radius*(tabtop-plim[3])*xmult
+  xcurve1<-xradius*cos(seq(0,pi/2,length.out=20))
+  xcurve2<-xradius*cos(seq(pi/2,pi,length.out=20))
+  tabx<-c(plim[2],
+   (plim[2]-xradius)+xcurve1,
+   (plim[1]+xradius)+xcurve2,
+   plim[1])
+  yradius<-radius*(tabtop-plim[3])
+  ycurve1<-yradius*sin(seq(0,pi/2,length.out=20))
+  ycurve2<-yradius*sin(seq(pi/2,pi,length.out=20))
+  taby<-c(plim[3],
+   tabtop-yradius+ycurve1,
+   tabtop-yradius+ycurve2,
+   plim[3])
+ }
+ par(xpd=TRUE)
+ polygon(tabx,taby,border=border,col=tab.col,lwd=lwd)
+ text((plim[1]+plim[2])/2,(plim[3]+tabtop)/2,label,
+  col=text.col)
+ par(xpd=FALSE,xlog=oldxlog,ylog=oldylog,cex=oldcex)
+}
diff --git a/R/taylor.diagram.R b/R/taylor.diagram.R
new file mode 100755
index 0000000..f1becdc
--- /dev/null
+++ b/R/taylor.diagram.R
@@ -0,0 +1,221 @@
+# Display a Taylor diagram
+# Taylor K.E. (2001)
+# Summarizing multiple aspects of model performance in a single diagram
+# Journal of Geophysical Research, 106: 7183-7192.
+
+# version 1.0
+# progr. Olivier.Eterradossi, 12/2007
+# 2007-01-12 - modifications and Anglicizing - Jim Lemon
+# version 2.0
+# progr. initiale OLE, 8/01/2007
+# rev. OLE 3/09/2008 : remove samples with NA's from mean, sd and cor calculations 
+# 2008-09-04 - integration and more anglicizing - Jim Lemon
+# 2008-12-09 - added correlation radii, sd arcs to the pos.cor=FALSE routine
+# and stopped the pos.cor=FALSE routine from calculating arcs for zero radius
+# Jim Lemon
+# 2010-4-30 - added the gamma.col argument for pos.cor=TRUE plots - Jim Lemon
+# 2010-6-24 - added mar argument to pos.cor=TRUE plots - Jim Lemon
+# 2012-1-31 - added the cex.axis argument - Jim Lemon
+
+taylor.diagram<-function(ref,model,add=FALSE,col="red",pch=19,pos.cor = TRUE, 
+    xlab = "", ylab = "", main = "Taylor Diagram", show.gamma = TRUE, 
+    ngamma = 3, gamma.col = 8, sd.arcs = 0, ref.sd = FALSE, sd.method = "sample", 
+    grad.corr.lines = c(0.2, 0.4, 0.6, 0.8, 0.9), pcex = 1, cex.axis = 1, 
+    normalize = FALSE, mar = c(5, 4, 6, 6), ...) {
+    
+    grad.corr.full <- c(0, 0.2, 0.4, 0.6, 0.8, 0.9, 0.95, 0.99, 1)
+  # convert any list elements or data frames to vectors
+   R <- cor(ref, model, use = "pairwise")
+    if (is.list(ref)) 
+        ref <- unlist(ref)
+    if (is.list(model)) 
+        ref <- unlist(model)
+    SD <- function(x, subn) {
+        meanx <- mean(x, na.rm = TRUE)
+        devx <- x - meanx
+        ssd <- sqrt(sum(devx * devx, na.rm = TRUE)/(length(x[!is.na(x)]) - 
+            subn))
+        return(ssd)
+    }
+    subn <- sd.method != "sample"
+    sd.r <- SD(ref, subn)
+    sd.f <- SD(model, subn)
+    if (normalize) {
+        sd.f <- sd.f/sd.r
+        sd.r <- 1
+    }
+    maxsd <- 1.5 * max(sd.f, sd.r)
+    oldpar <- par("mar", "xpd", "xaxs", "yaxs")
+    if (!add) {
+   # display the diagram
+       if (pos.cor) {
+            if (nchar(ylab) == 0) 
+                ylab = "Standard deviation"
+            par(mar = mar)
+            plot(0, xlim = c(0, maxsd), ylim = c(0, maxsd), xaxs = "i", 
+                yaxs = "i", axes = FALSE, main = main, xlab = xlab, 
+                ylab = ylab, type = "n", cex = cex.axis, ...)
+            if (grad.corr.lines[1]) {
+                for (gcl in grad.corr.lines) lines(c(0, maxsd * 
+                  gcl), c(0, maxsd * sqrt(1 - gcl^2)), lty = 3)
+            }
+   # add the axes
+           segments(c(0, 0), c(0, 0), c(0, maxsd), c(maxsd, 
+                0))
+            axis.ticks <- pretty(c(0, maxsd))
+            axis.ticks <- axis.ticks[axis.ticks <= maxsd]
+            axis(1, at = axis.ticks, cex.axis = cex.axis)
+            axis(2, at = axis.ticks, cex.axis = cex.axis)
+            if (sd.arcs[1]) {
+                if (length(sd.arcs) == 1) 
+                  sd.arcs <- axis.ticks
+                for (sdarc in sd.arcs) {
+                  xcurve <- cos(seq(0, pi/2, by = 0.03)) * sdarc
+                  ycurve <- sin(seq(0, pi/2, by = 0.03)) * sdarc
+                  lines(xcurve, ycurve, col = "blue", lty = 3)
+                }
+            }
+            if (show.gamma[1]) {
+    # if the user has passed a set of gamma values, use that
+                if (length(show.gamma) > 1) gamma <- show.gamma
+    # otherwise make up a set
+                else gamma <- pretty(c(0, maxsd), n = ngamma)[-1]
+                if (gamma[length(gamma)] > maxsd) 
+                  gamma <- gamma[-length(gamma)]
+                labelpos <- seq(45, 70, length.out = length(gamma))
+     # do the gamma curves
+               for (gindex in 1:length(gamma)) {
+                  xcurve <- cos(seq(0, pi, by = 0.03)) * gamma[gindex] + sd.r
+     # find where to clip the curves
+                  endcurve <- which(xcurve < 0)
+                  endcurve <- ifelse(length(endcurve), min(endcurve) - 
+                    1, 105)
+                  ycurve <- sin(seq(0, pi, by = 0.03)) * gamma[gindex]
+                  maxcurve <- xcurve * xcurve + ycurve * ycurve
+                  startcurve <- which(maxcurve > maxsd * maxsd)
+                  startcurve <- ifelse(length(startcurve), max(startcurve) + 
+                    1, 0)
+                  lines(xcurve[startcurve:endcurve], ycurve[startcurve:endcurve], 
+                    col = gamma.col)
+                  if (xcurve[labelpos[gindex]] > 0) 
+                    boxed.labels(xcurve[labelpos[gindex]], ycurve[labelpos[gindex]], 
+                      gamma[gindex], border = FALSE)
+                }
+            }
+  # the outer curve for correlation
+             xcurve <- cos(seq(0, pi/2, by = 0.01)) * maxsd
+            ycurve <- sin(seq(0, pi/2, by = 0.01)) * maxsd
+            lines(xcurve, ycurve)
+            bigtickangles <- acos(seq(0.1, 0.9, by = 0.1))
+            medtickangles <- acos(seq(0.05, 0.95, by = 0.1))
+            smltickangles <- acos(seq(0.91, 0.99, by = 0.01))
+            segments(cos(bigtickangles) * maxsd, sin(bigtickangles) * 
+                maxsd, cos(bigtickangles) * 0.97 * maxsd, sin(bigtickangles) * 
+                0.97 * maxsd)
+            par(xpd = TRUE)
+    # the inner curve for reference SD
+            if (ref.sd) {
+                xcurve <- cos(seq(0, pi/2, by = 0.01)) * sd.r
+                ycurve <- sin(seq(0, pi/2, by = 0.01)) * sd.r
+                lines(xcurve, ycurve)
+            }
+            points(sd.r, 0, cex = pcex)
+            text(cos(c(bigtickangles, acos(c(0.95, 0.99)))) * 
+                1.05 * maxsd, sin(c(bigtickangles, acos(c(0.95, 
+                0.99)))) * 1.05 * maxsd, c(seq(0.1, 0.9, by = 0.1), 
+                0.95, 0.99))
+            text(maxsd * 0.8, maxsd * 0.8, "Correlation", srt = 315)
+            segments(cos(medtickangles) * maxsd, sin(medtickangles) * 
+                maxsd, cos(medtickangles) * 0.98 * maxsd, sin(medtickangles) * 
+                0.98 * maxsd)
+            segments(cos(smltickangles) * maxsd, sin(smltickangles) * 
+                maxsd, cos(smltickangles) * 0.99 * maxsd, sin(smltickangles) * 
+                0.99 * maxsd)
+        }
+        else {
+            x <- ref
+            y <- model
+            R <- cor(x, y, use = "pairwise.complete.obs")
+            E <- mean(x, na.rm = TRUE) - mean(y, na.rm = TRUE)
+            xprime <- x - mean(x, na.rm = TRUE)
+            yprime <- y - mean(y, na.rm = TRUE)
+            sumofsquares <- (xprime - yprime)^2
+            Eprime <- sqrt(sum(sumofsquares)/length(complete.cases(x)))
+            E2 <- E^2 + Eprime^2
+            if (add == FALSE) {
+     # pourtour du diagramme (display the diagram)
+               maxray <- 1.5 * max(sd.f, sd.r)
+                plot(c(-maxray, maxray), c(0, maxray), type = "n", 
+                  asp = 1, bty = "n", xaxt = "n", yaxt = "n", 
+                  xlab = xlab, ylab = ylab, main = main, cex = cex.axis)
+                discrete <- seq(180, 0, by = -1)
+                listepoints <- NULL
+                for (i in discrete) {
+                  listepoints <- cbind(listepoints, maxray * 
+                    cos(i * pi/180), maxray * sin(i * pi/180))
+                }
+                listepoints <- matrix(listepoints, 2, length(listepoints)/2)
+                listepoints <- t(listepoints)
+                lines(listepoints[, 1], listepoints[, 2])
+     # axes x,y
+               lines(c(-maxray, maxray), c(0, 0))
+                lines(c(0, 0), c(0, maxray))
+    # lignes radiales jusque R = +/- 0.8
+                for (i in grad.corr.lines) {
+                  lines(c(0, maxray * i), c(0, maxray * sqrt(1 - 
+                    i^2)), lty = 3)
+                  lines(c(0, -maxray * i), c(0, maxray * sqrt(1 - 
+                    i^2)), lty = 3)
+                }
+   # texte radial
+                 for (i in grad.corr.full) {
+                  text(1.05 * maxray * i, 1.05 * maxray * sqrt(1 - 
+                    i^2), i, cex = 0.6)
+                  text(-1.05 * maxray * i, 1.05 * maxray * sqrt(1 - 
+                    i^2), -i, cex = 0.6)
+                }
+      # sd concentriques autour de la reference
+               seq.sd <- seq.int(0, 2 * maxray, by = (maxray/10))[-1]
+                for (i in seq.sd) {
+                  xcircle <- sd.r + (cos(discrete * pi/180) * 
+                    i)
+                  ycircle <- sin(discrete * pi/180) * i
+                  for (j in 1:length(xcircle)) {
+                    if ((xcircle[j]^2 + ycircle[j]^2) < (maxray^2)) {
+                      points(xcircle[j], ycircle[j], col = "darkgreen", 
+                        pch = ".")
+                      if (j == 10) 
+                        text(xcircle[j], ycircle[j], signif(i, 
+                          2), cex = 0.5, col = "darkgreen")
+                    }
+                  }
+                }
+     # sd concentriques autour de l'origine
+              seq.sd <- seq.int(0, maxray, length.out = 5)
+                for (i in seq.sd) {
+                  xcircle <- (cos(discrete * pi/180) * i)
+                  ycircle <- sin(discrete * pi/180) * i
+                  if (i) 
+                    lines(xcircle, ycircle, lty = 3, col = "blue")
+                  text(min(xcircle), -0.03 * maxray, signif(i, 
+                    2), cex = 0.5, col = "blue")
+                  text(max(xcircle), -0.03 * maxray, signif(i, 
+                    2), cex = 0.5, col = "blue")
+                }
+                text(0, -0.08 * maxray, "Standard Deviation", 
+                  cex = 0.7, col = "blue")
+                text(0, -0.12 * maxray, "Centered RMS Difference", 
+                  cex = 0.7, col = "darkgreen")
+                points(sd.r, 0, pch = 22, bg = "darkgreen", cex = 1.1)
+                text(0, 1.1 * maxray, "Correlation Coefficient", 
+                  cex = 0.7)
+            }
+            S <- (2 * (1 + R))/(sd.f + (1/sd.f))^2
+ #   Taylor<-S
+       }
+    }
+ # display the points
+    points(sd.f * R, sd.f * sin(acos(R)), pch = pch, col = col, 
+        cex = pcex)
+    invisible(oldpar)
+}
diff --git a/R/textbox.R b/R/textbox.R
new file mode 100755
index 0000000..0b430fb
--- /dev/null
+++ b/R/textbox.R
@@ -0,0 +1,68 @@
+#
+# Fix problems with plotrix package function textbox():
+#   1. 'cex' wasn't getting passed to text() so wasn't effective.
+#   2. Top of box was higher than specified y.
+#   3. Save and restore par('adj')
+#   4. 'justify' didn't do anything.  Redefined to left/center/right justify.  Text
+#           filling could be added later when value = TRUE.
+# And added features:
+#   1. New 'margin' argument.
+#   2. New arguments passed to text() and rect(): adj, font, vfont, col, border, fill,
+#           density, angle, lty, lwd.
+#
+#   textbox             Draw text in a box
+#
+#
+textbox <- function(x, y, textlist, justify=c('l','c','r'), cex=1, leading=0.5,
+    box=TRUE, adj=c(0,0), font=NULL, vfont=NULL, col=NULL, border=NULL, fill=NA,
+    density=NULL, angle=45, lty=par("lty"), lwd=par("lwd"), margin=0) {
+
+    if (length(margin) == 1) margin <- rep(margin, 4)
+    else if (length(margin) == 2) margin <- rep(margin, 2)
+    saveAdj <- par(adj=0)
+    textstr <- paste(textlist, collapse=" ")
+    words <- strsplit(textstr, " ")[[1]]
+    line.height <- strheight("hy", cex=cex, font=font, vfont=vfont) * (1+leading)
+    if (margin[2] > 0) x[1] <- x[1] + margin[2]
+    if (margin[3] > 0) y <- y - margin[3]
+    if (margin[4] > 0) x[2] <- x[2] - margin[4]
+    if (x[1] >= x[2]) x[2] <- x[1] + diff(par("usr")[1:2])*0.1
+    x.len <- diff(x)
+    y.pos <- y
+    x.pos <- x[1]
+    adj2 <- c(0,1)
+    if (justify[1] == 'c') {
+        x.pos <- x.pos + x.len/2
+        adj2[1] <- 0.5
+    }
+    else if (justify[1] == 'r') {
+        x.pos <- x.pos + x.len
+        adj2[1] <- 1
+    }
+    if (box) {
+        xbox <- x
+        ybox <- c(y.pos, y)
+        ybox[1] <- ybox[1] - abs(margin[1])
+        xbox[1] <- xbox[1] - abs(margin[2])
+        ybox[2] <- ybox[2] + abs(margin[3])
+        xbox[2] <- xbox[2] + abs(margin[4])
+        rect(xbox[1], ybox[1], xbox[2], ybox[2], border=border, col=fill, density=density,
+            angle=angle, lty=lty, lwd=lwd)
+        y.pos <- ybox[1]
+    }
+    curword <- 1
+    while (curword <= length(words)) {
+        curline <- ""
+        curline <- paste(curline, words[curword])
+        curword <- curword + 1
+        while (strwidth(paste(curline, words[curword]), cex=cex, font=font, vfont=vfont)
+                < x.len && !is.na(words[curword])) {
+            curline <- paste(curline, words[curword])
+            curword <- curword + 1
+        }
+        text(x.pos, y.pos, curline, adj=adj+adj2, cex=cex, col=col, font=font, vfont=vfont)
+        y.pos <- y.pos - line.height
+    }
+    par(saveAdj)
+    return(y.pos)
+}
diff --git a/R/thigmophobe.R b/R/thigmophobe.R
new file mode 100755
index 0000000..449b2e5
--- /dev/null
+++ b/R/thigmophobe.R
@@ -0,0 +1,87 @@
+# thigmophobe returns the direction (as 1|2|3|4 - see pos= in the text function) 
+# _away_ from the nearest point where x and y are vectors of 2D coordinates
+
+thigmophobe<-function(x,y) {
+ # if x has at least two columns, split it
+ if(missing(y)) {
+  if(is.list(x) && length(x) >= 2) {
+   y<-x[[2]]
+   x<-x[[1]]
+  }
+  else {
+   if(is.matrix(x) && dim(x)[2] >= 2) {
+    y<-x[,2]
+    x<-x[,1]
+   }
+   else
+    stop("if y is missing, x must be a list with at least 2 columns")
+  }
+ }
+ if(is.array(x)) x<-as.numeric(x)
+ if(is.array(y)) y<-as.numeric(y)
+ # get the current upper and lower limits of the plot
+ plot.span<-par("usr")
+ x.span<-plot.span[2] - plot.span[1]
+ y.span<-plot.span[4] - plot.span[3]
+ # if either axis is logarithmic, transform the values into logarithms
+ if(par("xlog")) x<-log(x)
+ if(par("ylog")) y<-log(y)
+ # scale the values to the plot span
+ # this avoids the numerically larger
+ # axis dominating the distance measure
+ x<-x/x.span
+ y<-y/y.span
+ # trash any names that may be attached to x or y
+ names(x)<-names(y)<-NULL
+ # get the distance matrix as a full matrix
+ xy.dist<-as.matrix(dist(cbind(x,y)))
+ lenx<-length(x)
+ nearest.index<-rep(0,lenx)
+ for(index in 1:lenx)
+  nearest.index[index]<-as.numeric(names(which.min(xy.dist[-index,index])))
+ # get the x and y differences for each point to the nearest point
+ xdiff<-x - x[nearest.index]
+ ydiff<-y - y[nearest.index]
+ # first set the east/west direction
+ dir.ew<-ifelse(xdiff > 0,4,2)
+ # now do the north/south
+ dir.ns<-ifelse(ydiff > 0,3,1)
+ dir.away<-ifelse(abs(xdiff)>abs(ydiff),dir.ew,dir.ns)
+ # set any congruent points to N/S labels or they'll overprint
+ for(i in 1:lenx) {
+  if(!xdiff[i] & !ydiff[i])
+   dir.away[c(i,nearest.index[i])]<-c(1,3)
+ }
+ return(dir.away)
+}
+
+# thigmophobe.labels positions labels at points so that they
+# are most distant from the nearest other point, where the
+# points are described as x and y coordinates.
+
+thigmophobe.labels<-function(x,y,labels=NULL,text.pos=NULL,...) {
+ if(missing(x))
+  stop("Usage: thigmophobe.labels(x,y,labels=1:length(x))")
+ lenx<-length(x)
+ # if x has at least two columns, split it
+ if(missing(y)) {
+  if(is.list(x) && lenx >= 2) {
+   y<-x[[2]]
+   x<-x[[1]]
+  }
+  else
+   stop("if y is missing, x must be a list with at least 2 elements")
+ }
+ # check for NA or NaN
+ validxy<-!(is.na(x) | is.na(y))
+ if(is.null(labels)) labels<-1:lenx
+ if(is.null(text.pos)) {
+  if(lenx > 1) text.pos<-thigmophobe(x[validxy],y[validxy])
+  else text.pos<-3
+ }
+ # allow labels to extend beyond the plot area
+ par(xpd=TRUE)
+ text(x[validxy],y[validxy],labels[validxy],pos=text.pos,...)
+ # restore the clipping
+ par(xpd=FALSE)
+}
diff --git a/R/triax.R b/R/triax.R
new file mode 100755
index 0000000..5e6b5c4
--- /dev/null
+++ b/R/triax.R
@@ -0,0 +1,285 @@
+get.triprop<-function(use.percentages=FALSE,cnames=c("1st","2nd","3rd")) {
+ cat("Enter the label and ")
+ cat(ifelse(use.percentages,"percentages ","proportions "))
+ cat("of",cnames[1],cnames[2],"and",cnames[3],"for each observation.\n")
+ cat("Enter a blank observation label to end.\n")
+ nextlabel<-"dummy"
+ nextprop<-0
+ proplabels<-NA
+ prop1<-NA
+ prop2<-NA
+ prop3<-NA
+ nprop<-0
+ totprop<-ifelse(use.percentages,100,1)
+ tolerance<-ifelse(use.percentages,1,0.01)
+ while(nchar(nextlabel)) {
+  nextlabel<-readline("Observation label - ")
+  if(nchar(nextlabel)) {
+   if(is.na(proplabels[1])) proplabels<-nextlabel
+   else proplabels<-c(proplabels,nextlabel)
+   cat(cnames[1],"- ")
+   nextprop<-as.numeric(readline())
+   if(is.na(prop1[1])) prop1<-nextprop
+   else prop1<-c(prop1,nextprop)
+   cat(cnames[2],"- ")
+   nextprop<-as.numeric(readline())
+   if(is.na(prop2[1])) prop2<-nextprop
+   else prop2<-c(prop2,nextprop)
+   cat(cnames[3],"- ")
+   nextprop<-as.numeric(readline())
+   if(is.na(prop3[1])) prop3<-nextprop
+   else prop3<-c(prop3,nextprop)
+   nprop<-nprop+1
+  }
+  sumprop<-prop1[nprop]+prop2[nprop]+prop3[nprop]
+  if(abs(totprop-sumprop) > tolerance)
+   cat("Warning - sum not equal to",totprop,"\n")
+ }
+ triprop<-cbind(prop1,prop2,prop3)
+ rownames(triprop)<-proplabels
+ colnames(triprop)<-cnames
+ return(triprop)
+}
+
+triax.abline<-function(b=NULL,r=NULL,l=NULL,col=par("col"),lty=par("lty"),
+ cc.axes=FALSE) {
+
+ sin60<-sin(pi/3)
+ if(!is.null(b)) {
+  if(any(b>1)) b<-b/100
+  if(cc.axes) {
+   bx2<-b+0.5*(1-b)
+   by2<-sin60*(1-b)
+   segments(b,0,bx2,by2,col=col,lty=lty)
+  }
+  else {
+   bx2<-0.5*(1-b)
+   by2<-sin60*(1-b)
+   segments(1-b,0,bx2,by2,col=col,lty=lty)
+  }
+ }
+ if(!is.null(r)) {
+  if(any(r>1)) r<-r/100
+  if(cc.axes) {
+   rx1<-0.5*r
+   ry1<-sin60*r
+   rx2<-1-r*0.5
+   segments(rx1,ry1,rx2,ry1,col=col,lty=lty)
+  }
+  else {
+   rx1<-0.5*(r+1)
+   ry1<-sin60*(1-r)
+   rx2<-1-r
+   segments(rx1,ry1,r,0,col=col,lty=lty)
+  }
+ }
+ if(!is.null(l)) {
+  if(any(l>1)) l<-l/100
+  if(cc.axes) {
+   lx1<-0.5-l*0.5
+   lx2<-1-l
+   ly<-sin60*(1-l)
+   segments(lx1,ly,lx2,0,col=col,lty=lty)
+  }
+  else {
+   lx1<-l*0.5
+   ly<-l*sin60
+   segments(lx1,ly,1-lx1,ly,col=col,lty=lty)
+  }
+ }
+}
+
+triax.points<-function(x,show.legend=FALSE,label.points=FALSE,
+ point.labels=NULL,col.symbols=par("fg"),pch=par("pch"),
+ bg.symbols=par("bg"),cc.axes=FALSE,...) {
+
+ if(dev.cur() == 1)
+  stop("Cannot add points unless the triax.frame has been drawn")
+ if(missing(x))
+  stop("Usage: triax.points(x,...)\n\twhere x is a 3 column array of proportions or percentages")
+ if(!is.matrix(x) && !is.data.frame(x))
+  stop("x must be a matrix or data frame with at least 3 columns and one row.")
+ if(any(x > 1) || any(x < 0)) {
+  if(any(x < 0))
+   stop("All proportions must be between zero and one.")
+  if(any(x > 100))
+   stop("All percentages must be between zero and 100.")
+  # convert percentages to proportions
+  x<-x/100
+ }
+ if(any(abs(rowSums(x)-1) > 0.01))
+  warning("At least one set of proportions does not equal one.")
+ sin60<-sin(pi/3)
+ if(cc.axes) {
+  ypos<-x[,3]*sin60
+  xpos<-x[,1]+x[,3]*0.5
+ }
+ else {
+  ypos<-x[,3]*sin60
+  xpos<-1-(x[,1]+x[,3]*0.5)
+ }
+ nobs<-dim(x)[1]
+ points(x=xpos,y=ypos,pch=pch,col=col.symbols,bg=bg.symbols,type="p",...)
+ if(is.null(point.labels)) point.labels<-rownames(x)
+ if(label.points) thigmophobe.labels(xpos,ypos,point.labels)
+ if(show.legend) {
+  legend(0.2,0.7,legend=point.labels,pch=pch,col=col.symbols,
+   xjust=1,yjust=0)
+ }
+ invisible(list(x=xpos,y=ypos))
+}
+
+triax.frame<-function(at=seq(0.1,0.9,by=0.1),axis.labels=NULL,
+ tick.labels=NULL,col.axis="black",cex.axis=1,cex.ticks=1,
+ align.labels=TRUE,show.grid=FALSE,col.grid="gray",lty.grid=par("lty"),
+ cc.axes=FALSE) {
+
+  sin60<-sin(pi/3)
+  # bottom ticks
+  bx1<-at
+  bx2<-bx1+0.01-0.02*cc.axes
+  by1<-rep(0,9)
+  if(cc.axes) by2<-rep(-0.02*sin(2*pi/3),9)
+  else by2<-rep(-0.02*sin60,9)
+  # left ticks
+  ly1<-at*sin60
+  lx1<-bx1*0.5
+  lx2<-lx1-0.02+0.013*cc.axes
+  if(cc.axes) ly2<-ly1+rep(0.014*sin60,9)
+  else ly2<-ly1
+  # right ticks
+  rx1<-at*0.5+0.5
+  rx2<-rx1+0.01
+  ry1<-rev(ly1)
+  if(cc.axes) ry2<-ry1
+  else ry2<-rev(ly2)+0.02*sin60
+  if(show.grid) {
+   par(fg=col.grid)
+   segments(bx1,by1,lx1,ly1,lty=lty.grid)
+   segments(lx1,ly1,rev(rx1),rev(ry1),lty=lty.grid)
+   segments(rx1,ry1,bx1,by1,lty=lty.grid)
+  }
+  par(fg=col.axis,xpd=TRUE)
+  if(is.null(tick.labels)) {
+   if(cc.axes) tick.labels<-list(l=rev(at),r=rev(at),b=rev(at))
+   else tick.labels<-list(l=at,r=at,b=at)
+  }
+  else {
+   if(cc.axes) {
+    tick.labels$l<-rev(tick.labels$l)
+    tick.labels$r<-rev(tick.labels$r)
+    tick.labels$b<-rev(tick.labels$b)
+   }
+  }
+  # left axis label
+  if(align.labels) par(srt=60)
+  text(0.13,0.5,axis.labels[3-cc.axes],adj=0.5,cex=cex.axis)
+  # left axis tick labels
+  if(cc.axes) {
+   par(srt=300)
+   xoffset<-0.02
+   yoffset<-0.04
+  }
+  else {
+   par(srt=0)
+   xoffset<-0.05
+   yoffset<-0
+  }
+  text(lx1-xoffset,ly1+yoffset,tick.labels$l,cex=cex.ticks)
+  # right axis label
+  if(align.labels) {
+   par(srt=300)
+   label.adj<-0.5
+  }
+  else {
+   par(srt=0)
+   label.adj<-0
+  }
+  text(0.86,0.52,axis.labels[2+cc.axes],adj=label.adj,cex=cex.axis)
+  # right axis tick labels
+  if(cc.axes) {
+   par(srt=0)
+   xoffset<-0.033
+   yoffset<-0.005
+  }
+  else {
+   par(srt=60)
+   xoffset<-0.015
+   yoffset<-0.045
+  }
+  text(rx2+xoffset,ry1+yoffset,tick.labels$r,cex=cex.ticks)
+  # bottom axis tick labels
+  if(cc.axes) {
+   par(srt=60)
+   xoffset<- -0.03
+  }
+  else {
+   par(srt=300)
+   xoffset<-0.03
+  }
+  text(bx1+xoffset,by1-0.05,rev(tick.labels$b),cex=cex.ticks)
+  # bottom axis label
+  par(srt=0)
+  text(0.5,-0.14,axis.labels[1],cex=cex.axis)
+  # draw the triangle and ticks
+  x1<-c(0,0,0.5)
+  x2<-c(1,0.5,1)
+  y1<-c(0,0,sin60)
+  y2<-c(0,sin60,0)
+  par(fg=col.axis)
+  segments(x1,y1,x2,y2)
+  # bottom ticks
+  segments(bx1,by1,bx2,by2)
+  # left ticks
+  segments(lx1,ly1,lx2,ly2)
+  # right ticks
+  segments(rx1,ry1,rx2,ry2)
+}
+
+triax.fill<-function(col) {
+ nrows<-length(col)
+ sin60<-sin(pi/3)
+ rowlen<-1
+ xinc<-0.5/nrows
+ yinc<-sin60/nrows
+ for(trirow in 1:nrows) {
+  startx<-0.5-xinc*(trirow-1)
+  starty<-sin60-trirow*yinc
+  dir<-1
+  for(triangle in 1:rowlen) {
+   polygon(c(startx-xinc,startx,startx+xinc),
+    c(starty,starty+yinc*dir,starty),border=NA,
+    col=col[[trirow]][triangle])
+   startx<-startx+xinc
+   starty<-starty+yinc*dir
+   dir<--dir
+  }
+  rowlen<-rowlen+2
+ }
+}
+
+triax.plot<-function (x=NULL,main="",at=seq(0.1,0.9,by=0.1),
+  axis.labels=NULL,tick.labels=NULL,col.axis="black",
+  cex.axis=1,cex.ticks=1,align.labels=TRUE,show.grid=FALSE,
+  col.grid="gray",lty.grid=par("lty"),cc.axes=FALSE,
+  show.legend=FALSE,label.points=FALSE,point.labels=NULL,
+  col.symbols="black",pch=par("pch"),mar=c(5,2,4,2),no.add=TRUE,...) {
+
+  oldpar<-par("fg","pty","mar","srt","xpd")
+  par(xpd=TRUE)
+  if(is.null(axis.labels)) axis.labels<-colnames(x)[1:3]
+  par(pty="s",mar=mar)
+  plot(0.5,type="n",axes=FALSE,xlim=c(0,1),ylim=c(0,1),main=main,
+   xlab="",ylab="")
+  triax.frame(at=at,axis.labels=axis.labels,
+   tick.labels=tick.labels,col.axis=col.axis,cex.axis=cex.axis,
+   cex.ticks=cex.ticks,align.labels=align.labels,show.grid=show.grid,
+   col.grid=col.grid,lty.grid=lty.grid,cc.axes=cc.axes)
+  if(is.null(x)) xypos <- NULL
+  else
+   xypos<-triax.points(x,show.legend=show.legend,
+    label.points=label.points,point.labels=point.labels,
+    col.symbols=col.symbols,pch=pch,cc.axes=cc.axes,...)
+  if(no.add) par(oldpar)
+  invisible(list(xypos=xypos,oldpar=oldpar))
+}
diff --git a/R/tsxpos.R b/R/tsxpos.R
new file mode 100644
index 0000000..ebdcb35
--- /dev/null
+++ b/R/tsxpos.R
@@ -0,0 +1,16 @@
+tsxpos<-function(x,xlim,nint) {
+ # make sure that there is a graphics device open
+ if(dev.cur() == 1) stop("A graphics device must be open")
+ if(missing(xlim)) {
+  plotlim<-par("usr")
+  divlim<-ifelse(par("xaxs") == "r",0.04,0)
+  xrange<-(plotlim[2]-plotlim[1])/(1+2*divlim)
+  xstart<-plotlim[1]+xrange*divlim
+ }
+ else {
+  xstart<-xlim[1]
+  xrange<-diff(xlim)
+ }
+ if(missing(nint)) nint<-length(x)-1
+ return(cumsum(c(xstart,rep(xrange/nint,nint))))
+}
diff --git a/R/twoord.plot.R b/R/twoord.plot.R
new file mode 100755
index 0000000..2898fc9
--- /dev/null
+++ b/R/twoord.plot.R
@@ -0,0 +1,131 @@
+color.axis<-function(side=1,at=NULL,labels=TRUE,axlab=NA,axlab.at=NA,
+ col=par("fg"),cex.axis=par("cex.axis"),cex=par("cex")) {
+
+ xylim<-par("usr")
+ if(side %% 2) {
+  if(min(at) < xylim[1]) at<-at[at >= xylim[1]]
+  if(max(at) > xylim[2]) at<-at[at <= xylim[2]]
+ }
+ else {
+  if(min(at) < xylim[3]) at<-at[at >= xylim[3]]
+  if(max(at) > xylim[4]) at<-at[at <= xylim[4]]
+ }
+ axis(side=side,at=at,labels=rep("",length(at)),col=col)
+ if(labels[1] == TRUE && length(labels) == 1) labels<-at
+ mtext(labels,side=side,at=at,line=0.7,col=col,cex=cex.axis)
+ if(!is.na(axlab)) {
+  if(is.na(axlab.at))
+   axlab.at<-ifelse(side%%2,sum(xylim[1:2])/2,sum(xylim[3:4])/2)
+  mtext(axlab,side=side,at=axlab.at,line=2,col=col,cex=cex)
+ }
+ if(side == 1) abline(h=xylim[3],col=col)
+ if(side == 2) abline(v=xylim[1],col=col)
+ if(side == 3) abline(h=xylim[4],col=col)
+ if(side == 4) abline(v=xylim[2],col=col)
+}
+
+twoord.plot<-function(lx,ly,rx,ry,data=NULL,main="",xlim=NULL,lylim=NULL, 
+ rylim=NULL,mar=c(5,4,4,4),lcol=1,rcol=2,xlab="",
+ lytickpos=NA,ylab="",ylab.at=NA,rytickpos=NA,rylab="",rylab.at=NA,
+ lpch=1,rpch=2,type="b",xtickpos=NULL,xticklab=NULL,halfwidth=0.4,
+ axislab.cex=1,do.first=NULL,...) {
+
+ if(!is.null(data)) {
+  ly<-unlist(data[ly])
+  ry<-unlist(data[ry])
+  if(missing(lx)) lx<-1:length(ly)
+  else lx<-unlist(data[lx])
+  if(missing(rx)) rx <- 1:length(ry)
+  else rx<-unlist(data[rx])
+ }
+ if(missing(lx)) lx<-1:length(ly)
+ if(missing(ry)) {
+  if(missing(rx)) {
+   rx<-1:length(ry)
+   ry<-ly
+   ly<-lx
+   lx<-1:length(ly)
+  }
+  else {
+   ry<-rx
+   rx<-1:length(ry)
+  }
+ }
+ oldmar<-par("mar")
+ par(mar=mar)
+ if(is.null(xlim)) xlim<-range(c(lx,rx))
+ if(missing(lx)) lx<-1:length(ly)
+ if(is.null(lylim)) {
+  lylim<-range(ly,na.rm=TRUE)
+  lyspan<-diff(lylim)
+  if(lyspan == 0) lyspan<-lylim[1]
+  lylim[2]<-lylim[2]+lyspan*0.04
+  if(lylim[1] != 0) lylim[1]<-lylim[1]-lyspan*0.04
+ }
+ if(length(type) < 2) type<-rep(type,2)
+ # first display the "left" plot
+ if(match(type[1],"bar",0)) {
+  oldcex<-par(cex=axislab.cex)
+  plot(lx,ly,xlim=xlim,ylim=lylim,xlab=xlab,ylab="",yaxs="i",type="n", 
+   main="",axes=FALSE,...)
+  par(oldcex)
+  if(!is.null(do.first)) eval(parse(text=do.first))
+  ybottom<-par("usr")[3]
+  if (lylim[1] < 0) abline(h=0,lty=2)
+  rect(lx-halfwidth,ifelse(ly<0,ly,ybottom),lx+halfwidth,
+   ifelse(ly>0,ly,0),col=lcol)
+ }
+ else {
+  oldcex<-par(cex=axislab.cex)
+  plot(lx,ly,xlim=xlim,ylim=lylim,xlab=xlab,ylab="",yaxs="i",type="n", 
+   main="",axes=FALSE,...)
+  par(oldcex)
+  if(!is.null(do.first)) eval(parse(text=do.first))
+  points(lx,ly,col=lcol,pch=lpch,type=type[1],...)
+ }
+ title(main=main)
+ xylim<-par("usr")
+ #mtext(ylab,2,2,col=lcol,cex=axislab.cex)
+ box()
+ # display the X axis
+ if(is.null(xticklab)) axis(1,cex.axis=axislab.cex)
+ else {
+  if(is.null(xtickpos)) xtickpos<-1:length(xticklab)
+  axis(1,at=xtickpos,labels=xticklab,cex.axis=axislab.cex)
+ }
+ # display the left axis
+ if(is.na(lytickpos[1])) lytickpos<-pretty(ly)
+ if(is.na(ylab.at)) ylab.at<-mean(lytickpos)
+ color.axis(2,at=lytickpos,axlab=ylab,axlab.at=ylab.at, 
+  col=ifelse(is.na(lcol),1,lcol),cex.axis=axislab.cex,cex = axislab.cex)
+ # get the "right" y limits
+ if(is.null(rylim)) {
+  rylim<-range(ry,na.rm=TRUE)
+  ryspan<-diff(rylim)
+  if(ryspan == 0) ryspan<-rylim[1]
+  rylim[2]<-rylim[2]+ryspan*0.04
+  if(rylim[1] != 0) rylim[1]<-rylim[1]-ryspan*0.04
+ }
+ # multiplier for the "right" y values
+ ymult<-diff(lylim)/diff(rylim)
+# offset for the "right" y values
+ yoff<-lylim[1]-rylim[1]*ymult
+ if(match(type[2],"bar",0)) {
+  if(rylim[1] < 0) abline(h=0,lty=2)
+  rect(rx-halfwidth,ifelse(ry<0,ry,rylim[1]*ymult+yoff),rx+halfwidth,
+   ifelse(ry>0,ry*ymult+yoff,0),col=rcol)
+ }
+ else points(rx,ry*ymult+yoff,col=rcol,pch=rpch,type=type[2],...)
+ if(is.na(rytickpos[1])) rylabels<-pretty(rylim)
+ else rylabels<-rytickpos
+ if(min(rylabels) < rylim[1]) rylabels<-rylabels[rylabels >= rylim[1]]
+ if(max(rylabels) > rylim[2]) rylabels<-rylabels[rylabels <= rylim[2]]
+ axat<-rylabels*ymult+yoff
+ if(is.na(rylab.at)) rylab.at<-mean(rytickpos)
+ if(!is.na(rylab.at)) rylab.at<-rylab.at*ymult+yoff
+ # display the right axis
+ color.axis(4,at=axat,labels=rylabels,axlab=rylab, 
+  axlab.at=rylab.at,col=ifelse(is.na(rcol),1,rcol), 
+  cex.axis=axislab.cex,cex=axislab.cex)
+ par(mar=oldmar,new=FALSE,col.axis="black")
+}
diff --git a/R/twoord.stackplot.R b/R/twoord.stackplot.R
new file mode 100755
index 0000000..8520ae4
--- /dev/null
+++ b/R/twoord.stackplot.R
@@ -0,0 +1,165 @@
+
+twoord.stackplot <- function(lx, rx, ldata, rdata, lcol, rcol, ltype, rtype, 
+	border, rylab, lylab, xlab, ..., incrylim=NULL,
+	halfwidth=0.4, leftfront=FALSE, mar = c(5, 4, 4, 4))
+{
+	ltype <- sapply(ltype, function(x) match.arg(x, c("p","l","b","c","o","bar")))
+	rtype <- sapply(rtype, function(x) match.arg(x, c("p","l","b","c","o","bar")))
+	
+	incrylim <- ifelse(is.null(incrylim), 0, as.numeric(incrylim))
+
+	#convert to matrix	
+	if(is.vector(ldata))
+		ldata <- as.matrix(ldata)
+	if(is.vector(rdata))
+		rdata <- as.matrix(rdata)
+		
+	
+	#some default parameters
+	if(missing(border))
+		border <- "grey80"
+	if(missing(xlab))
+		xlab <- "x"
+	if(missing(rylab))
+		rylab <- "right y values"		
+	if(missing(lylab))
+		lylab <- "left y values"	
+	if(missing(lcol))
+		lcol <- palette()[1:NCOL(ldata)]		
+	if(missing(rcol))
+		rcol <- palette()[1:NCOL(rdata)]		
+		
+	
+	xlimits <- range(lx, rx)	
+	
+	#assume line plot for the left data, and barplot for the right data
+    oldmar <- par("mar")
+    par(mar = mar)
+    	
+	if(leftfront)
+	{
+		twoord.stackplot(rx, lx, rdata, ldata, rcol, lcol, rtype, ltype, 
+			border, lylab, rylab, xlab, ..., incrylim=NULL,
+			halfwidth=0.4, leftfront=FALSE, mar = c(5, 4, 4, 4))
+		return(invisible())
+	}
+	
+	#------------------------------------------------------------------------
+	#left y-axis plot
+	if(NCOL(ldata) > 1)
+	{
+	    lcol <- rep(lcol, length=NCOL(ldata))
+	    ltype <- rep(ltype, length=NCOL(ldata))
+	}    	
+	if(any(ltype == "bar"))
+	{	
+		#------------------	
+		lylimits <- range(ifelse(ldata <0, ldata, 0), rowSums(ldata))
+		lylimits[1] <- ifelse(lylimits[1] > 0, lylimits[1]*(1-incrylim), lylimits[1]*(1+incrylim)) 
+		lylimits[2] <- ifelse(lylimits[2] > 0, lylimits[2]*(1+incrylim), lylimits[2]*(1-incrylim)) 
+		
+		
+		plot(0, type = "n", axes = FALSE, xlim = xlimits, ylim = lylimits, 
+			ylab="", xlab=xlab, ...)
+            
+		xbottom <- par("usr")[1]
+		xylim <- par("usr")
+		ly <- ldata[,1]
+		rect(lx-halfwidth, ifelse(ly < 0, ly, xbottom), lx+halfwidth, 
+			ifelse(ly > 0, ly, 0), col=lcol[1], border=border, ...)
+	
+		if(NCOL(ldata) > 1)
+			for(i in 2:NCOL(ldata))
+			{
+				ly <- ldata[,i]
+				rect(lx-halfwidth, ifelse(ly < 0, ly, xbottom)+ldata[,i-1], 
+					lx+halfwidth, ifelse(ly > 0, ly, 0)+ldata[,i-1], col=lcol[i], 
+					border=border, ...)
+			}	
+		
+	}else
+	{
+		#------------------
+		lylimits <- range(ldata)
+		lylimits[1] <- ifelse(lylimits[1] > 0, lylimits[1]*(1-incrylim), lylimits[1]*(1+incrylim)) 
+		lylimits[2] <- ifelse(lylimits[2] > 0, lylimits[2]*(1+incrylim), lylimits[2]*(1-incrylim)) 
+		
+		plot(lx, ldata[, 1], xlim=xlimits, ylim=lylimits, col=lcol[1], 
+			type=ltype[1], axes=FALSE, ylab="", xlab=xlab, ...)
+		
+		if(NCOL(ldata) > 1)
+			for(i in 2:NCOL(ldata))
+				lines(lx, ldata[, i], col=lcol[i], type=ltype[i], ...)
+	}
+	
+	xylim <- par("usr")
+	mtext(lylab, 2, 2, col = lcol[1])
+		
+	axis(1) #x axis
+	axat <- axis(2, col=lcol[1], labels=FALSE) #left y axis
+	abline(v=xylim[1], col=lcol[1])
+	mtext(axat, 2, 1, at = axat, col = lcol[1])
+
+	box()	
+	
+
+	#------------------------------------------------------------------------
+	#right y-axis plot
+	par(new=TRUE)
+		
+	if(NCOL(rdata) > 1)
+	{
+	    rcol <- rep(rcol, length=NCOL(rdata))
+	    rtype <- rep(rtype, length=NCOL(rdata))
+	}    	
+	
+	if(any(rtype == "bar"))
+	{
+		#------------------	
+		rylimits <- range(ifelse(rdata <0, rdata, 0), rowSums(rdata))
+		rylimits[1] <- ifelse(rylimits[1] > 0, rylimits[1]*(1-incrylim), rylimits[1]*(1+incrylim)) 
+		rylimits[2] <- ifelse(rylimits[2] > 0, rylimits[2]*(1+incrylim), rylimits[2]*(1-incrylim)) 
+		
+		ry <- rdata[,1]
+		plot(0, type = "n", axes = FALSE, xlim = xlimits, ylim = rylimits, 
+			ylab="", xlab="", ...)
+            
+		xbottom <- par("usr")[1]
+		xylim <- par("usr")
+		rect(rx-halfwidth, ifelse(ry < 0, ry, xbottom), rx+halfwidth, 
+			ifelse(ry > 0, ry, 0), col=rcol[1], border=border, ...)
+	
+		if(NCOL(rdata) > 1)
+			for(i in 2:NCOL(rdata))
+			{
+				ry <- rdata[,i]
+				rect(rx-halfwidth, ifelse(ry < 0, ry, xbottom)+rdata[,i-1], 
+				rx+halfwidth, ifelse(ry > 0, ry, 0)+rdata[,i-1], col=rcol[i], 
+				border=border, ...)
+
+			}	
+	}else
+	{
+		#------------------	
+		rylimits <- range(rdata)
+		rylimits[1] <- ifelse(rylimits[1] > 0, rylimits[1]*(1-incrylim), rylimits[1]*(1+incrylim)) 
+		rylimits[2] <- ifelse(rylimits[2] > 0, rylimits[2]*(1+incrylim), rylimits[2]*(1-incrylim)) 
+		
+		plot(rx, rdata[, 1], xlim=xlimits, ylim=rylimits, col=rcol[1], 
+			type=rtype[1], axes=FALSE, ylab="", xlab="", ...)
+		
+		if(NCOL(rdata) > 1)		
+			for(i in 2:NCOL(rdata))
+				lines(rx, rdata[, i], col=rcol[i], type=rtype[i], ...)
+	}
+	
+	
+	axat <- axis(4, col=rcol[1], labels=FALSE) #right y axis
+	abline(v=xylim[1], col=rcol[1])
+	mtext(axat, 4, 1, at = axat, col = rcol[1])
+
+	mtext(rylab, 4, 2, col = rcol[1])
+	
+	par(mar = oldmar)   	
+}
+
diff --git a/R/vectorField.R b/R/vectorField.R
new file mode 100755
index 0000000..028e061
--- /dev/null
+++ b/R/vectorField.R
@@ -0,0 +1,37 @@
+# Arguments:
+# u,v - the x (longitude) and y (latitude) offsets
+# OR orientation and magnitude
+# xpos,ypos - the centers of the vectors
+# scale - the longest arrow as a proportion of the cell size
+# headspan - the extent of the arrowhead as a proportion of cell size
+# this function doesn't assume a 1:1 aspect ratio
+
+vectorField<-function (u, v, xpos = NA, ypos = NA, scale = 1, headspan = 0.1, 
+    vecspec = c("lonlat", "rad", "deg"), col = par("fg")) 
+{
+    udim <- dim(u)
+    if (is.na(xpos[1])) 
+        xpos <- col(u)
+    if (is.na(ypos[1])) 
+        ypos <- udim[1] - row(u) + 1
+    ymult <- getYmult()
+    if (match(vecspec[1], "lonlat", 0) == 0) {
+        if (match(vecspec[1], "deg", 0)) 
+            u <- pi * u/180
+        mag <- v
+        tempu <- v * cos(u)
+        v <- v * sin(u) * ymult
+        u <- tempu
+    }
+    else mag <- sqrt(u * u + v * v)
+    if (is.null(dim(xpos))) 
+        maxmag <- 0.5 * max(diff(as.numeric(xpos)))/max(mag)
+    else maxmag <- 0.5 * max(diff(as.numeric(xpos[1, ])))/max(mag)
+    u2 <- u * scale * maxmag
+    v2 <- v * scale * maxmag
+    if (is.null(udim)) 
+        length = headspan
+    else length <- headspan * par("pin")[1]/udim[2]
+    arrows(xpos - u2, ypos - v2, xpos + u2, ypos + v2, length = length, 
+        col = col)
+}
diff --git a/R/weighted.hist.R b/R/weighted.hist.R
new file mode 100755
index 0000000..36c9ff0
--- /dev/null
+++ b/R/weighted.hist.R
@@ -0,0 +1,64 @@
+get.breaks<-function(x,breaks) {
+ # if a break computing function name is passed
+ if(is.character(breaks)) 
+  nbreaks<-do.call(paste("nclass",breaks,sep=".",collapse=""),list(x))
+ # if breaks is numeric
+ if(is.numeric(breaks)) {
+  # if just the number of breaks is passed
+  if(length(breaks) == 1) {
+   nbreaks<-breaks
+  }
+  # otherwise assume that breaks specifies the breakpoints
+  else return(breaks)
+ }
+ breakinc<-diff(range(x))/nbreaks
+ breaks<-c(min(x),rep(breakinc,nbreaks))
+ breaks<-cumsum(breaks)
+ return(breaks)
+}
+
+weighted.hist<-function(x,w,breaks="Sturges",col=NULL,plot=TRUE,
+ freq=TRUE,ylim=NA,ylab=NULL,xaxis=TRUE,...) {
+ 
+ if(missing(x))
+  stop("Usage: weighted.hist(x,...) vector of values x required")
+ if(missing(w)) w<-rep(1,length(x))
+ breaks<-get.breaks(x,breaks)
+ width<-diff(breaks)
+ diffx<-diff(range(x))
+ equidist<-sum(width-width[1]) < diffx/1000
+ nbreaks<-length(breaks)-1
+ # make sure that the last break is greater than the maximum value
+ lastbreak<-breaks[nbreaks+1]
+ breaks[nbreaks+1]<-breaks[nbreaks+1]+diffx/1000
+ if(diff(range(breaks)) < diffx)
+   warning("Not all values will be included in the histogram")
+ counts<-rep(0,nbreaks)
+ for(bin in 1:nbreaks)
+  counts[bin]<-sum(w[x >= breaks[bin] & x < breaks[bin+1]])
+ density<-counts/sum(counts)
+ if(freq) {
+  if(is.null(ylab)) ylab<-"Frequency"
+  heights<-counts
+  if(!equidist) 
+   warning("Areas will not relate to frequencies")
+ }
+ else {
+  if(!equidist) {
+   heights<-density*mean(width)/width
+   heights<-heights/sum(heights)
+  }
+  else heights<-density
+  if(is.null(ylab)) ylab<-"Density"
+ }
+ if(plot) {
+  if(is.null(col)) col<-par("bg")
+  if(is.na(ylim)) ylim<-c(0,1.1*max(heights,na.rm=TRUE))
+  mids<-barplot(heights,width=width,col=col,space=0,ylim=ylim,ylab=ylab,...)
+  tickpos<-c(mids-width/2,mids[length(mids)]+width[length(width)]/2)
+  if(xaxis) axis(1,at=tickpos,labels=signif(c(breaks[1:nbreaks],lastbreak),3))
+ }
+ else mids<-breaks[-length(breaks)]+width/2
+ invisible(list(breaks=breaks,counts=counts,density=density,
+ mids=mids,xname=deparse(substitute(x)),equidist=equidist))
+}
diff --git a/R/windrose.R b/R/windrose.R
new file mode 100755
index 0000000..b3b66e6
--- /dev/null
+++ b/R/windrose.R
@@ -0,0 +1,99 @@
+bin.wind.records<-function(winddir,windspeed,ndir=8,radians=FALSE,
+ speed.breaks=c(0,10,20,30)) {
+ # the windagg matrix has wind speeds as rows and wind directions as columns
+ windagg<-matrix(0,ncol=ndir,nrow=5)
+ dir.breaks<-rep(0,ndir)
+ if(radians) {
+  angleinc<-2*pi/ndir
+  dir.breaks[1]<-pi/ndir
+ }
+ else {
+  angleinc<-360/ndir
+  dir.breaks[1]<-180/ndir
+ }
+ for(i in 2:ndir) dir.breaks[i]<-dir.breaks[i-1]+angleinc
+ nspeeds<-length(speed.breaks)+1
+ for(i in 1:length(winddir)) {
+  dir<-1
+  while(winddir[i] > dir.breaks[dir] && dir < ndir) dir<-dir+1
+  if(winddir[i] > dir.breaks[ndir]) dir<-1
+  speed<-1
+  while(windspeed[i] > speed.breaks[speed] && speed < nspeeds) speed<-speed+1
+  windagg[speed,dir]<-windagg[speed,dir]+1
+ }
+ windagg<-100*windagg/sum(windagg)
+ return(windagg)
+}
+
+oz.windrose.legend<-function(maxpct=20,scale.factor=30,
+ speed.col=c("#dab286","#fe9a66","#ce6733","#986434"),
+ speed.width=NA,legend.pos=NA) {
+  
+ wdnames<-c("E","NE","N","NW","W","SW","S","SE")
+ if(is.na(speed.width[1])) speed.width<-maxpct*1:4/100
+ if(is.na(legend.pos[1])) legend.pos<-maxpct*1.25
+ draw.circle(-maxpct/2,legend.pos,maxpct/20)
+ angles<-seq(0,7*pi/4,by=pi/4)
+ for(i in 1:8) {
+  x<-cos(angles[i])*c(maxpct/20,maxpct/16,maxpct/10)-maxpct/2
+  y<-sin(angles[i])*c(maxpct/20,maxpct/16,maxpct/10)+legend.pos
+  segments(x[1],y[1],x[2],y[2])
+  text(x[3],y[3],wdnames[i],cex=0.7)
+ }
+ wsnames<-c("1-10","10-20","20-30","30+")
+ draw.circle(-maxpct/30,legend.pos,maxpct/30)
+ for(i in 1:length(speed.col)) {
+  x<-c(i-1,i)*maxpct/4
+  y<-c(legend.pos-speed.width[i],legend.pos+speed.width[i])
+  polygon(c(x[1],x[1],x[2],x[2]),c(y[1],y[2],y[2],y[1]),col=speed.col[i])
+  text((x[1]+x[2])/2,legend.pos-maxpct/15,wsnames[i],cex=0.7)
+ }
+ text(-maxpct/30,legend.pos+maxpct/10,"Calm")
+ text(maxpct/2,legend.pos+maxpct/10,"km/h")
+ text(maxpct/2,legend.pos-maxpct/8,paste("Scale factor = ",scale.factor,"%",sep=""))
+}
+
+oz.windrose<-function(windagg,maxpct=20,wrmar=c(4,5,6,5),
+ scale.factor=30,speed.col=c("#dab286","#fe9a66","#ce6733","#986434"),
+ speed.width=NA,show.legend=TRUE,legend.pos=NA,...) {
+ 
+ if(is.na(speed.width[1])) speed.width<-maxpct*1:4/100
+ if(is.na(legend.pos[1])) legend.pos<-maxpct*1.25
+ oldmar<-par("mar")
+ par(mar=wrmar,xpd=TRUE)
+ plot(0,xlim=c(-maxpct,maxpct),ylim=c(-maxpct,maxpct),type="n",
+  axes=FALSE,xlab="",ylab="",...)
+ winddim<-dim(windagg)
+ calm.radius<-sum(windagg[1,])/winddim[2]
+ rad<-10
+ while(rad<=maxpct) {
+  draw.circle(0,0,rad+calm.radius,border="gray")
+  boxed.labels(rad+calm.radius,maxpct/10,paste(rad,"%",sep=""),ypad=0.7,border=FALSE)
+  rad<-rad+10
+ }
+ draw.circle(0,0,calm.radius,border="gray")
+ angle.inc<--2*pi/winddim[2]
+ angles<-seq(5*pi/2,pi/2+angle.inc,by=angle.inc)
+ descpct<-order(colSums(windagg),decreasing=TRUE)
+ for(i in descpct) {
+  next.radius<-calm.radius
+  for(j in 2:winddim[1]) {
+   xinner<-cos(angles[i])*next.radius
+   xouter<-cos(angles[i])*(windagg[j,i]+next.radius)
+   yinner<-sin(angles[i])*next.radius
+   youter<-sin(angles[i])*(windagg[j,i]+next.radius)
+   next.radius<-sqrt(xouter*xouter+youter*youter)
+   # find the four points for each rectangle
+   xoffset<-cos(angles[i]-pi/2)*speed.width[j-1]
+   yoffset<-sin(angles[i]-pi/2)*speed.width[j-1]
+   polygon(c(xinner-xoffset,xinner+xoffset,xouter+xoffset,xouter-xoffset),
+    c(yinner-yoffset,yinner+yoffset,youter+yoffset,youter-yoffset),
+    col=speed.col[j-1])
+  }
+ }
+ text(-maxpct,maxpct/4,paste("Calm ",round(sum(windagg[1,]),1),"%",sep=""),col="blue")
+ if(show.legend)
+  oz.windrose.legend(maxpct=maxpct,scale.factor=scale.factor,speed.col=speed.col,
+   speed.width=speed.width,legend.pos=legend.pos)
+ par(oldmar)
+}
diff --git a/R/zoomInPlot.R b/R/zoomInPlot.R
new file mode 100755
index 0000000..ed285d1
--- /dev/null
+++ b/R/zoomInPlot.R
@@ -0,0 +1,55 @@
+zoomInPlot<-function(x,y=NULL,xlim=NULL,ylim=NULL,rxlim=xlim,rylim=ylim,
+ xend=NA,zoomtitle=NULL,titlepos=NA,...) {
+ par(mfrow=c(1,2))
+ if(is.null(y)) {
+  y<-x
+  x<-1:length(x)
+ }
+ if(is.null(xlim[1])) xlim<-range(x)
+ if(is.null(ylim[1])) ylim<-range(y)
+ plot(x,y,xlim=xlim,ylim=ylim,...)
+ xext<-yext<-rxext<-ryext<-0
+ if(par("xaxs") == "r") {
+  xext<-diff(xlim)*0.04
+  rxext<-diff(rxlim)*0.04
+ }
+ if(par("yaxs") == "r") {
+  yext<-diff(ylim)*0.04
+  ryext<-diff(rylim)*0.04
+ }
+ if(is.na(rxlim[1])) {
+  newbox<-locator(2)
+  rxlim<-sort(newbox$x)
+  rylim<-sort(newbox$y)
+ }
+ rect(rxlim[1]-rxext,rylim[1]-ryext,rxlim[2]+rxext,rylim[2]+ryext)
+ xylim<-par("usr")
+ xypin<-par("pin")
+ rxi0<-xypin[1]*(xylim[2]-(rxlim[1]-rxext))/diff(xylim[1:2])
+ rxi1<-xypin[1]*(xylim[2]-(rxlim[2]+rxext))/diff(xylim[1:2])
+ y01i<-xypin[2]*(xylim[4]-(rylim[2]+ryext))/diff(xylim[3:4])
+ y02i<-xypin[2]*((rylim[1]-ryext)-xylim[3])/diff(xylim[3:4])
+ plot(x,y,xlim=rxlim,ylim=rylim,...)
+ xypin<-par("pin")
+ par(xpd=NA)
+ xylim<-par("usr")
+ xymai<-par("mai")
+ x0<-xylim[1]-diff(xylim[1:2])*(xymai[2]+xymai[4]+rxi0)/xypin[1]
+ x1<-xylim[1]-diff(xylim[1:2])*(xymai[2]+xymai[4]+rxi1)/xypin[1]
+ y01<-xylim[4]-diff(xylim[3:4])*y01i/xypin[2]
+ y02<-xylim[3]+diff(xylim[3:4])*y02i/xypin[2]
+ par(xpd=TRUE)
+ if(!is.null(zoomtitle)) {
+  if(is.na(titlepos)) titlepos<-getFigCtr()[1]
+  mtext(zoomtitle,at=titlepos,cex=1.5,line=1.5)
+ }
+ if(is.na(xend)) xend<-xylim[1]-diff(xylim[1:2])*xymai[2]/(2*xypin[1])
+ xprop0<-(xylim[1]-xend)/(xylim[1]-x0)
+ xprop1<-(xylim[2]-xend)/(xylim[2]-x1)
+ par(xpd=NA)
+ segments(c(x0,x0,x1,x1),c(y01,y02,y01,y02),
+  c(xend,xend,xend,xend),
+  c(xylim[4]-(xylim[4]-y01)*xprop0,xylim[3]+(y02-xylim[3])*xprop0,
+  xylim[4]-(xylim[4]-y01)*xprop1,xylim[3]+(y02-xylim[3])*xprop1))
+ par(xpd=FALSE,mfrow=c(1,1))
+}
diff --git a/data/death_reg.rda b/data/death_reg.rda
new file mode 100644
index 0000000..16f1185
Binary files /dev/null and b/data/death_reg.rda differ
diff --git a/data/soils.rda b/data/soils.rda
new file mode 100755
index 0000000..338fac6
Binary files /dev/null and b/data/soils.rda differ
diff --git a/debian/README.test b/debian/README.test
deleted file mode 100644
index f837af2..0000000
--- a/debian/README.test
+++ /dev/null
@@ -1,7 +0,0 @@
-Notes on how this package can be tested.
-────────────────────────────────────────
-
-This package can be tested by loading it into R with the command
-‘library(plotrix)’ in order to confirm its integrity.
-
- -- Andreas Tille <tille at debian.org>  Thu, 20 May 2010 15:43:36 +0200
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
index 7d39d4e..0000000
--- a/debian/changelog
+++ /dev/null
@@ -1,132 +0,0 @@
-r-cran-plotrix (3.6-4-1) unstable; urgency=medium
-
-  * New upstream version
-  * debhelper 10
-
- -- Andreas Tille <tille at debian.org>  Thu, 05 Jan 2017 17:22:16 +0100
-
-r-cran-plotrix (3.6-3-1) unstable; urgency=medium
-
-  * New upstream version
-  * Convert to dh-r
-  * Canonical homepage for CRAN
-  * d/watch: version=4
-
- -- Andreas Tille <tille at debian.org>  Tue, 08 Nov 2016 19:30:49 +0100
-
-r-cran-plotrix (3.6-1) unstable; urgency=medium
-
-  * new upstream version
-  * Moved debian/upstream to debian/upstream/metadata
-  * cme fix dpkg-control
-
- -- Andreas Tille <tille at debian.org>  Sat, 31 Oct 2015 08:10:39 +0100
-
-r-cran-plotrix (3.5-7-1) unstable; urgency=medium
-
-  * New upstream version
-  * cme fix dpkg-control
-
- -- Andreas Tille <tille at debian.org>  Fri, 27 Jun 2014 15:39:46 +0200
-
-r-cran-plotrix (3.4-7-1) unstable; urgency=low
-
-  * New upstream version
-  * debian/control:
-     - Fixed Vcs-Browser
-     - Standards-Version: 3.9.4 (no changes needed)
-     - debhelper 9 (also debian/compat)
-     - normalised
-  * debian/copyright: DEP5
-  * debian/rules:
-     - Remove unneeded code to create R:Depends
-     - Remove executable bit of some documentation files
-  * debian/upstream: add citation information
-
- -- Andreas Tille <tille at debian.org>  Fri, 17 May 2013 10:21:57 +0200
-
-r-cran-plotrix (3.2-6-1) unstable; urgency=low
-
-  * New upstream version
-  * Rebuild against latest R
-    Closes: #646048
-  * Standards-Version: 3.9.2 (no changes needed)
-  * Debhelper 8 (control+compat)
-  * Fixed Vcs fields
-  * mv debian/README.Debian debian/README.test
-
- -- Andreas Tille <tille at debian.org>  Tue, 25 Oct 2011 13:34:39 +0200
-
-r-cran-plotrix (3.0-3-1) unstable; urgency=low
-
-  * New upstream version
-  * Standards-Version: 3.9.1 (no changes needed)
-  * debian/source/format: 3.0 (quilt)
-
- -- Andreas Tille <tille at debian.org>  Fri, 26 Nov 2010 09:09:39 +0100
-
-r-cran-plotrix (2.9-3-2) unstable; urgency=low
-
-  * debian/rules: Make sure whitespace is really a tab to get
-    R:Depends substvar working
-
- -- Andreas Tille <tille at debian.org>  Mon, 31 May 2010 16:04:00 +0200
-
-r-cran-plotrix (2.9-3-1) unstable; urgency=low
-
-  * New upstream version
-  * Depend on a version equal or superior than the R upstream release that
-    was used to build this package, using a R:Depends substvar
-    (debian/control, debian/rules).
-  * debian/copyright: More specific value for Upstream-Source field
-  * debian/README.Debian: explain how to test this package
-
- -- Andreas Tille <tille at debian.org>  Thu, 20 May 2010 15:43:36 +0200
-
-r-cran-plotrix (2.8-1) unstable; urgency=low
-
-  * New upstream version
-  * Standards-Version: 3.8.4 (no changes needed)
-  * debian/watch: do not use version mangling with dashes in upstream
-    source
-  * debian/get-orig-source: Removed because uscan is sufficient
-
- -- Andreas Tille <tille at debian.org>  Wed, 10 Feb 2010 15:12:01 +0100
-
-r-cran-plotrix (2.7.2-1) unstable; urgency=low
-
-  * New upstream version
-
- -- Andreas Tille <tille at debian.org>  Fri, 30 Oct 2009 13:08:02 +0100
-
-r-cran-plotrix (2.7-1) unstable; urgency=low
-
-  * New upstream version
-  * Standards-Version: 3.8.3 (no changes needed)
-
- -- Andreas Tille <tille at debian.org>  Tue, 08 Sep 2009 13:36:36 +0200
-
-r-cran-plotrix (2.5.5-1) unstable; urgency=low
-
-  * New upstream version
-  * debian/control
-    - Arch: all
-    - Changed sectiond from math to gnu-r
-
- -- Andreas Tille <tille at debian.org>  Wed, 18 Mar 2009 10:12:34 +0100
-
-r-cran-plotrix (2.5.3-1) unstable; urgency=low
-
-  * New upstream version
-  * Fixed Vcs fields
-  * Better long description
-    Closes: #520213
-  * Standards-Version: 3.8.1 (no changes needed)
-
- -- Andreas Tille <tille at debian.org>  Wed, 18 Mar 2009 10:02:38 +0100
-
-r-cran-plotrix (2.5.1-1) unstable; urgency=low
-
-  * Initial release (Closes: #512069).
-
- -- Andreas Tille <tille at debian.org>  Sun, 08 Feb 2009 09:58:22 +0100
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index f599e28..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-10
diff --git a/debian/control b/debian/control
deleted file mode 100644
index 6cadb6a..0000000
--- a/debian/control
+++ /dev/null
@@ -1,40 +0,0 @@
-Source: r-cran-plotrix
-Maintainer: Debian Science Team <debian-science-maintainers at lists.alioth.debian.org>
-Uploaders: Andreas Tille <tille at debian.org>
-Section: gnu-r
-Priority: optional
-Build-Depends: debhelper (>= 10),
-               dh-r,
-               r-base-dev
-Standards-Version: 3.9.8
-Vcs-Browser: https://anonscm.debian.org/viewvc/debian-science/packages/R/r-cran-plotrix/trunk/
-Vcs-Svn: svn://anonscm.debian.org/debian-science/packages/R/r-cran-plotrix/trunk/
-Homepage: https://cran.r-project.org/package=plotrix
-
-Package: r-cran-plotrix
-Architecture: all
-Depends: ${misc:Depends},
-         ${R:Depends}
-Recommends: ${R:Recommends}
-Suggests: ${R:Suggests}
-Description: GNU R package providing various plotting functions
- This R package provides lots of plots, various labeling, axis and color scaling
- functions.  Some of them are:
- .
-  arctext:          Display text on a circular arc.
-  barhier:          Display a set of hierarchically associated variables
-  barp:             A bar plotting routine
-  bin.wind.records: Classify wind direction and speed records.
-  centipede.plot:   Display a centipede plot
-  clock24.plot:     Plot values on a 24 hour "clockface".
-  color.legend:     Legend matching categories or values to colors
-  dotplot.mtb:      Minitab style dotplots.
-  gantt.chart:      Display a Gantt chart
-  intersectDiagram: Display set intersections
-  multhist:         Plot a multiple histogram, as a barplot
-  polar.plot:       Plot values on a circular grid of 0 to 360 degrees.
-  vectorField:      Display magnitude/direction vectors
-  weighted.hist:    Display a weighted histogram
- .
- and many more.  Read more about this package at
- http://cran.r-project.org/web/packages/plotrix/plotrix.pdf
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644
index 99a7b02..0000000
--- a/debian/copyright
+++ /dev/null
@@ -1,34 +0,0 @@
-Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: plotrix
-Upstream-Contact: Jim Lemon <jim at bitwrit.com.au>
-Source: https://cran.r-project.org/package=plotrix
-
-Files: *
-Copyright: (C) 2008-2016 Jim Lemon, Ben Bolker, Sander Oom, Eduardo Klein,
-                     Barry Rowlingson, Hadley Wickham, Anupam Tyagi,
-                     Olivier Eterradossi, Gabor Grothendieck, Michael Toews,
-                     John Kane, Mike Cheetham, Rolf Turner, Carl Witthoft,
-                     Julian Stander, Thomas Petzoldt
-License: GPL-2+
-
-Files: debian/*
-Copyright: 2009-2016 Andreas Tille <tille at debian.org>
-License: GPL-2+
-
-License: GPL-2+
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- .
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
- .
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- .
- On Debian systems, the complete text of the GNU General Public
- License can be found in `/usr/share/common-licenses/GPL'.
diff --git a/debian/rules b/debian/rules
deleted file mode 100755
index 19e9123..0000000
--- a/debian/rules
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/make -f
-
-%:
-	dh $@ --buildsystem R
-
-override_dh_fixperms:
-	dh_fixperms
-	find debian -name INDEX -exec chmod -x \{\} \;
-	find debian -name CITATION -exec chmod -x \{\} \;
diff --git a/debian/source/format b/debian/source/format
deleted file mode 100644
index 163aaf8..0000000
--- a/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/debian/upstream/metadata b/debian/upstream/metadata
deleted file mode 100644
index 9cbfe1d..0000000
--- a/debian/upstream/metadata
+++ /dev/null
@@ -1,10 +0,0 @@
-Reference:
-  Author: Jim Lemon
-  Title: "Plotrix: a package in the red light district of R"
-  Journal: R-News
-  Year: 2006
-  Volume: 6
-  Number: 4
-  Pages: 8-12
-  URL: http://cran.r-project.org/web/packages/plotrix/
-  eprint: http://www.r-project.org/doc/Rnews/Rnews_2006-4.pdf
diff --git a/debian/watch b/debian/watch
deleted file mode 100644
index c387315..0000000
--- a/debian/watch
+++ /dev/null
@@ -1,2 +0,0 @@
-version=4
-http://cran.r-project.org/src/contrib/plotrix_([\d.-]*)\.tar\.gz
diff --git a/demo/00Index b/demo/00Index
new file mode 100755
index 0000000..9c9c8be
--- /dev/null
+++ b/demo/00Index
@@ -0,0 +1 @@
+plotrix		demo of many plotrix functions
diff --git a/demo/plotrix.R b/demo/plotrix.R
new file mode 100755
index 0000000..1a88d72
--- /dev/null
+++ b/demo/plotrix.R
@@ -0,0 +1,387 @@
+# The plotrix demo in roughly alphabetical order
+# Press <Enter> to advance through the demo,
+# Ctrl-C (Linux) or Esc (Windows) to exit
+par(ask=TRUE)
+x <- rnorm(100)
+y <- x + rnorm(100)
+lmfit <- lm(y~x)
+par(xaxs="r",yaxs="r")
+plot(x,y,xlim=c(-3.5,3.5),main="Ablineclip")
+ablineclip(lmfit,x1=-2,x2=2,lty=2)
+ablineclip(h=0,x1=-2,x2=2,lty=3,col="red")
+ablineclip(v=0,y1=-2.5,y2=1.5,lty=4,col="green")
+testdf<-data.frame(Before=c(10,7,5),During=c(8,6,2),After=c(5,3,4))
+rownames(testdf)<-c("Red","Green","Blue")
+barp(testdf,main="Test addtable2plot",ylab="Value",
+ names.arg=colnames(testdf),col=2:4)
+addtable2plot(2,8,testdf,bty="o",display.rownames=TRUE,hlines=TRUE,
+ title="The table")
+plot(0,xlim=c(1,5),ylim=c(1,5),main="Arctext",xlab="",ylab="",
+ type="n")
+arctext("bendy like spaghetti",center=c(3,3),col="blue")
+arctext("bendy like spaghetti",center=c(3,3),radius=1.5,start=pi,cex=2)
+arctext("bendy like spaghetti",center=c(3,3),radius=0.5,
+ start=pi/2,stretch=1.2)
+plot(3:10,main="Axis break test",yaxt="n")
+# put a break at the default axis and position
+axis.break()
+axis(2,at=3:10,labels=c(0,4:10))
+axis.break(2,style="zigzag")
+twogrp<-c(rnorm(10)+4,rnorm(10)+20)
+gap.plot(twogrp,gap=c(8,16),xlab="Index",ylab="Group values",
+ main="Two separated groups with gap axis break",
+ col=c(rep(2,10),rep(3,10)),ytics=c(3,5,18,20))
+legend(12,6,c("Low group","High group"),pch=1,col=2:3)
+plot(1:10*0.001,1:10*100,axes=FALSE,xlab="",ylab="",main="Axis multipliers")
+box()
+axis.mult(1,mult=0.001,mult.label="X")
+axis.mult(2,mult=100,mult.label="Y")
+par(mar=c(5,5,4,2))
+test.df<-data.frame(Age=rnorm(100,25,10),
+ Sex=sample(c("M","F"),100,TRUE),
+ Marital=sample(c("M","X","S","W"),100,TRUE),
+ Employ=sample(c("FT","PT","NO"),100,TRUE))
+test.col<-list(Overall="green",Employ=c("purple","orange","brown"),
+ Marital=c("#1affd8","#caeecc","#f7b3cc","#94ebff"),Sex=c(2,4))
+barNest(formula=Age~Employ+Marital+Sex,data=test.df,main="barNest",
+ col=test.col,showall=TRUE,ylab="Mean age")
+happyday<-data.frame(Monday=c(2.3,3.4),Tuesday=c(2.8,3.3),Wednesday=c(3.2,3.1),
+Thursday=c(3.6,2.8),Friday=c(4.2,2.6),Saturday=c(4.5,2.9),Sunday=c(4.1,2.8))
+happylabels<-c("Utterly dashed","Rather mopey","Indifferent","Somewhat elated",
+ "Euphoric")
+barp(happyday,names.arg=names(happyday),legend.lab=c("Slaves","Unemployed"),
+ legend.pos=list(x=2,y=4.5),col=c("#ee7700","#3333ff"),
+ main="Test of barp, staxlab and color.legend",
+ xlab="Day of week",ylab="Happiness rating",ylim=c(1,5),staxx=TRUE,staxy=TRUE,
+ height.at=1:5,height.lab=happylabels,cex.axis=1,cylindrical=TRUE,
+ shadow=TRUE)
+par(mar=c(5,4,4,2))
+h1<-table(cut(rnorm(100,4),breaks=seq(0,8,by=2)))
+h2<-table(cut(rnorm(100,4),breaks=seq(0,8,by=2)))
+h3<-table(cut(rnorm(100,4),breaks=seq(0,8,by=2)))
+hmat<-matrix(c(h1,h2,h3),nrow=3,byrow=TRUE)
+barp(hmat,names.arg=names(h1),width=0.45,col=2:4,
+ main="Multiple histogram using barp",xlab="Bins",ylab="Frequency")
+legend(3.8,50,c("h1","h2","h3"),fill=2:4)
+x<-rnorm(10)
+y<-rnorm(10)
+plot(x,y,type="p",main="Boxed.labels")
+nums<-c("one","two","three","four","five","six","seven","eight","nine","ten")
+boxed.labels(x,y-0.1,nums)
+test.df<-data.frame(a=rnorm(80)+4,b=rnorm(80)+4,c=rep(LETTERS[1:4],each=20),
+ d=rep(rep(letters[1:4],each=4),5))
+bp<-brkdn.plot("a","c","d",test.df,main="Test of brkdn.plot",
+ mct="median",md="mad",xlab="Temperature range", ylab="Cognition",
+ xaxlab=c("10-15","16-20","21-25","25-30"),pch=1:4,lty=1:4,col=1:4,ylim=c(0,6))
+legend(1,2.5,legend=c("Sydney","Gosford","Karuah","Brisbane"),pch=1:4,
+ col=1:4,lty=1:4,xjust=0.5,yjust=0.5)
+educattn<-matrix(c(90.4,90.3,75.7,78.9,66,71.8,70.5,70.4,68.4,67.9,
+ 67.2,76.1,68.1,74.7,68.5,72.4,64.3,71.2,73.1,77.8),ncol=2,byrow=TRUE)
+rownames(educattn)<-c("Anchorage AK","Boston MA","Chicago IL",
+ "Houston TX","Los Angeles CA","Louisville KY","New Orleans LA",
+ "New York NY","Philadelphia PA","Washington DC")
+colnames(educattn)<-c(1990,2000)
+bumpchart(educattn,rank=FALSE,
+ main="Percentage high school completion by over 25s",col=rainbow(10))
+# margins have been reset, so use
+par(xpd=TRUE)
+boxed.labels(1.5,seq(65,90,by=5),seq(65,90,by=5))
+par(xpd=FALSE)
+testcp<-list("",40)
+for(i in 1:40) testcp[[i]]<-rnorm(sample(1:8,1)*50)
+segs<-get.segs(testcp)
+centipede.plot(segs,main="Centipede plot",vgrid=0)
+xy.mat<-cbind(sample(1:10,200,TRUE),sample(1:10,200,TRUE))
+clusteredpoints<-
+ cluster.overplot(xy.mat,col=rep(c("red","green"),each=100))
+plot(clusteredpoints,col=clusteredpoints$col,
+ main="Cluster overplot test")
+xy.mat<-cbind(sample(1:10,200,TRUE),sample(1:10,200,TRUE))
+count.overplot(xy.mat,main="Count overplot test",
+ xlab="X values",ylab="Y values")
+ par(mar=c(7,4,4,6))
+testcol<-color.gradient(c(0,1),0,c(1,0),nslices=5)
+col.labels<-c("Cold","Warm","Hot")
+color2D.matplot(matrix(rnorm(100),nrow=10),c(1,0),0,c(0,1),
+ main="Test color2D.matplot with color.legend")
+color.legend(11,6,11.8,9,col.labels,testcol,gradient="y")
+color.legend(10.2,2,11,5,col.labels,testcol,align="rb",gradient="y")
+color.legend(0.5,-2,3.5,-1.2,col.labels,testcol)
+color.legend(7,-1.8,10,-1,col.labels,testcol,align="rb",col=testcol[c(1,3,5)])
+par(mar=c(5,4,4,2))
+x<-c(0,cumsum(rnorm(99)))
+y<-c(0,cumsum(rnorm(99)))
+xydist<-sqrt(x*x+y*y)
+plot(x,y,main="Random walk plot (color.scale.lines)",xlab="X",ylab="Y",type="n")
+color.scale.lines(x,y,c(1,1,0),0,c(0,1,1),colvar=xydist,lwd=2)
+boxed.labels(x,y,labels=1:100,border=FALSE,cex=0.5)
+testlen<-rnorm(24)*2+5
+testpos<-0:23+rnorm(24)/4
+clock24.plot(testlen[7:19],testpos[7:19],
+ main="Test Clock24 daytime (symbols)",
+ point.col="blue",rp.type="s",lwd=3)
+par(mar=c(5,4,4,2))
+x<-seq(1,100)
+y<-sin(x/5)+x/20
+clplot(x,y,main="Clplot")
+x<-list(runif(90,1,2),factor(sample(LETTERS,100,TRUE)),rnorm(80,mean=5))
+dendroPlot(x,breaks=list(seq(1,2,by=0.1),0,0:10),nudge=c(0.03,0.3),
+ xlab="Groups",ylab="Counts",main="Test dendroPlot")
+data(mtcars)
+mysubset<-mtcars[substr(dimnames(mtcars)[[1]],1,1)=="M",c("mpg","hp","wt","disp")]
+diamondplot(mysubset,name="Diamondplot")
+plot(1:10, asp = 1,main="Test draw.arc")
+draw.arc(5, 5, 1:10/10, deg2 = 1:10*10, col = "blue")
+draw.arc(8, 8, 1:10/10, deg2 = 1:10*10, col = 1:10)
+plot(1:5,seq(1,10,length=5),type="n",xlab="",ylab="",main="Test draw.circle")
+draw.circle(2,4,c(1,0.66,0.33),border="purple",
+ col=c("#ff00ff","#ff77ff","#ffccff"),lty=1,lwd=1)
+draw.circle(2.5,8,0.6,border="red",lty=3,lwd=3)
+draw.circle(4,3,0.7,border="green",lty=1,lwd=1)
+draw.circle(3.5,7,0.8,border="blue",lty=2,lwd=2)
+x<-rnorm(10)
+y<-rnorm(10)
+plot(x,y,main="Find the empty space",xlab="X",ylab="Y")
+es<-emptyspace(x,y)
+boxed.labels(es,labels="Here is the\nempty space")
+iucn.df<-data.frame(area=c("Africa","Asia","Europe","N&C America",
+ "S America","Oceania"),threatened=c(5994,7737,1987,4716,5097,2093))
+fan.plot(iucn.df$threatened,max.span=pi,
+ labels=paste(iucn.df$area,iucn.df$threatened,sep="-"),
+ main="Threatened species by geographical area (fan.plot)",ticks=276)
+feather.plot(0.6+rnorm(8)/5,seq(0,7*pi/4,by=pi/4),1:8,
+ main="Test of feather.plot",xlab="Time",ylab="Value")
+plot(1:5,type="n",main="Floating Pie test",xlab="",ylab="",axes=FALSE)
+box()
+polygon(c(0,0,5.5,5.5),c(0,3,3,0),border="#44aaff",col="#44aaff")
+floating.pie(1.7,3,c(2,4,4,2,8),radius=0.5,
+ col=c("#ff0000","#80ff00","#00ffff","#44bbff","#8000ff"))
+floating.pie(3.1,3,c(1,4,5,2,8),radius=0.5,
+ col=c("#ff0000","#80ff00","#00ffff","#44bbff","#8000ff"))
+floating.pie(4,1.5,c(3,4,6,7),radius=0.5,
+ col=c("#ff0066","#00cc88","#44bbff","#8000ff"))
+draw.circle(3.9,2.1,radius=0.04,col="white")
+draw.circle(3.9,2.1,radius=0.04,col="white")
+draw.circle(3.9,2.1,radius=0.04,col="white")
+draw.circle(4,2.3,radius=0.04,col="white")
+draw.circle(4.07,2.55,radius=0.04,col="white")
+draw.circle(4.03,2.85,radius=0.04,col="white")
+text(c(1.7,3.1,4),c(3.7,3.7,3.7),c("Pass","Pass","Fail"))
+Ymd.format<-"%Y/%m/%d"
+gantt.info<-list(labels=
+ c("First task","Second task","Third task","Fourth task","Fifth task"),
+ starts=
+ as.POSIXct(strptime(
+ c("2004/01/01","2004/02/02","2004/03/03","2004/05/05","2004/09/09"),
+ format=Ymd.format)),
+ ends=
+ as.POSIXct(strptime(
+ c("2004/03/03","2004/05/05","2004/05/05","2004/08/08","2004/12/12"),
+ format=Ymd.format)),
+ priorities=c(1,2,3,4,5))
+vgridpos<-as.POSIXct(strptime(c("2004/01/01","2004/02/01","2004/03/01",
+ "2004/04/01","2004/05/01","2004/06/01","2004/07/01","2004/08/01",
+ "2004/09/01","2004/10/01","2004/11/01","2004/12/01"),format=Ymd.format))
+vgridlab<-
+ c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
+gantt.chart(gantt.info,main="Calendar date Gantt chart (2004)",
+ priority.legend=TRUE,vgridpos=vgridpos,vgridlab=vgridlab,hgrid=TRUE)
+twogrp<-c(rnorm(10)+4,rnorm(10)+20)
+gap.barplot(twogrp,gap=c(8,16),xlab="Index",ytics=c(3,6,17,20),
+ ylab="Group values",main="gap.barplot")
+twovec<-list(vec1=c(rnorm(30),-6),vec2=c(sample(1:10,40,TRUE),20))
+gap.boxplot(twovec,gap=list(top=c(12,18),bottom=c(-5,-3)),
+ main="Test gap.boxplot")
+twogrp<-c(rnorm(5)+4,rnorm(5)+20,rnorm(5)+5,rnorm(5)+22)
+gpcol<-c(2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5)
+gap.plot(twogrp,gap=c(8,16),xlab="Index",ylab="Group values",
+ main="Test gap.plot",col=gpcol)
+plot(0:10,type="n",axes=FALSE,main="gradient.rect")
+gradient.rect(1,0,3,6,reds=c(1,0),
+ greens=c(seq(0,1,length=10),seq(1,0,length=10)),
+ blues=c(0,1),gradient="y")
+gradient.rect(4,0,6,6,c(seq(0,1,length=10),rep(1,10)),
+ c(rep(1,10),seq(1,0,length=10)),c(0,0),gradient="y")
+gradient.rect(7,0,9,6,col=smoothColors("red",38,"blue"),border=NA)
+druguse<-matrix(c(sample(c(0,1),200,TRUE),
+ sample(c(0,1),200,TRUE),
+ sample(c(0,1),200,TRUE),
+ sample(c(0,1),200,TRUE)),ncol=4)
+colnames(druguse)<-c("Alc","Tob","THC","Amp")
+druglist<-makeIntersectList(druguse)
+intersectDiagram(druglist)
+testmat<-matrix(c(runif(50),sample(1:25,50,TRUE),rnorm(50)+5,
+ sin(1:50)),ncol=50,byrow=TRUE)
+kiteChart(testmat,varlabels=c("Uniform","Sample","Normal","Sine"),
+ timepos=seq(1,50,by=5))
+didf<-data.frame(subject=1:50,interv=rep(c("therapist","ex-drinker"),each=25),
+ outcome=sample(c("more","less"),50,TRUE))
+didf.tab<-table(didf$interv,didf$outcome)
+didf2<-c(74,46,200)
+didf3<-c(33,87,500)
+x<-list(didf.tab,didf2,didf3)
+labbecol<-list("red","green","blue")
+labbePlot(x,main="Ex-drinkers vs therapists",
+ xlab="Percent reduced drinking (ex-drinkers)",
+ ylab="Percent reduced drinking (therapists)",
+ labels=list("A","B52","X117"),col=labbecol)
+l <- list(runif(10)*10,1:10,c(1,1,1,1,4,8))
+multhist(l,main="Test of multhist")
+windagg<-matrix(c(8,0,0,0,0,0,0,0,4,6,2,1,6,3,0,4,2,8,5,3,5,2,1,1,
+ 5,5,2,4,1,4,1,2,1,2,4,0,3,1,3,1),nrow=5,byrow=TRUE)
+par(mar=c(5,4,4,2))
+oz.windrose(windagg,legend.pos=-25,wrmar=c(5,5,6,5),
+ main="Australian BoM wind rose")
+y<-runif(8)
+oldpar<-panes()
+boxplot(y,axes=FALSE)
+box()
+tab.title("Boxplot of y",tab.col="#88dd88")
+barplot(y,axes=FALSE,col=2:9)
+box()
+tab.title("Barplot of y",tab.col="#88dd88")
+pie(y,col=2:9)
+tab.title("Pie chart of y",tab.col="#88dd88")
+box()
+plot(y,xaxs="i",xlim=c(0,9),axes=FALSE,col=2:9)
+box()
+tab.title("Scatterplot of y",tab.col="#88dd88")
+# center the title at the left edge of the last plot
+mtext("Test of panes function",at=0,side=1,line=0.8,cex=1.5)
+par(oldpar)
+pieval<-c(2,4,6,8)
+pielabels<-
+ c("We hate\n pies","We oppose\n  pies","We don't\n  care","We just love pies")
+pie3D(pieval,radius=0.9,labels=pielabels,explode=0.1,main="3D PIE OPINIONS")
+sex<-sample(c("M","F"),100,TRUE)
+hair<-sample(c("Blond","Black","Brown","Red"),100,TRUE)
+eye<-sample(c("Blue","Black","Brown","Green"),100,TRUE)
+charac<-data.frame(sex=sex,hair=hair,eye=eye)
+characlist<-makeDendrite(charac)
+plot.dendrite(characlist,names(charac),
+ main="Dendrogram of sex, hair and eye color",cex=0.8)
+xy.pop<-c(3.2,3.5,3.6,3.6,3.5,3.5,3.9,3.7,3.9,3.5,3.2,2.8,2.2,1.8,
+ 1.5,1.3,0.7,0.4)
+xx.pop<-c(3.2,3.4,3.5,3.5,3.5,3.7,4,3.8,3.9,3.6,3.2,2.5,2,1.7,1.5,
+ 1.3,1,0.8)
+agelabels<-c("0-4","5-9","10-14","15-19","20-24","25-29","30-34",
+ "35-39","40-44","45-49","50-54","55-59","60-64","65-69","70-74",
+ "75-79","80-44","85+")
+mcol<-color.gradient(c(0,0,0.5,1),c(0,0,0.5,1),c(1,1,0.5,1),18)
+fcol<-color.gradient(c(1,1,0.5,1),c(0.5,0.5,0.5,1),c(0.5,0.5,0.5,1),18)
+par(mar=pyramid.plot(xy.pop,xx.pop,labels=agelabels,
+ main="Australian population pyramid 2002",lxcol=mcol,rxcol=fcol,
+ gap=0.5,show.values=TRUE))
+posmat<-matrix(sample(2:9,30,TRUE),nrow=3)
+radial.plot(posmat,labels=paste("X",1:10,sep=""),rp.type="p",
+ main="Spiderweb plot (radial.plot)",line.col=2:4,show.grid=FALSE,lwd=1:3,
+ radial.lim=c(0,10))
+x <- runif(20)
+y <- runif(20)
+revaxis(x,y,yside=4,main="Test revaxis")
+x <- c(0.1,0.1,0.1,0.1,0.1,0.2,0.2,0.2,0.2,0.3,0.3)
+y <- c( 1,  1,  1,  1,  2,  2,  2,  3,  3,  4,  5 )
+plot(x,y)
+sizeplot(x,y,main="sizeplot")
+cat1<-sample(c("None","Low","Medium","High"),40,TRUE)
+cat2<-sample(c("None","Low","Medium","High"),40,TRUE)
+cat3<-sample(c("None","Low","Medium","High"),40,TRUE)
+hcats<-data.frame(cat1,cat2,cat3)
+bhcol<-list(c("#ff8080","#dddd80","#80ff80","#8080ff"),
+ c("red","green","lightblue","yellow"),
+ c("#ffffff","#bbbbbb","#999999","#666666"))
+sizetree(hcats,col=bhcol,main="sizetree (hierarchical count chart)")
+soils.sw.percent<-data.frame(
+ Sand=c(67,67,66,67,36,25,24,59,27,9,8,8,20,
+ 45,50,56,34,29,39,41,94,98,97,93,96,99),
+ Silt=c(17,16,9,8,39,48,54,27,46,70,68,68,66,
+ 34,30,24,48,53,46,48,2,2,2,4,1,1),
+ Clay=c(16,17,25,25,25,27,22,14,27,21,24,24,
+ 14,21,20,20,18,18,15,11,4,0,1,3,3,0))
+soils.sw.cols <- c(1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3,
+ 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6)
+soils.sw.names <- c("Ardington","Astrop","Atrim",
+ "Banbury","Beacon","Beckfoot")
+soil.texture.uk(soils.sw.percent,
+ main = "Ternary Diagram for Some Soils from South West England",
+ col.lines = "black", col.names = "black", show.grid = TRUE,
+ col.grid = "blue", lty.grid = 2,  pch = 16, cex = 1.0,
+ col.symbols = soils.sw.cols, h1 = NA, h3 = NA, t1 = NA,
+ t3 = NA , lwduk = 2, xpos = NA, ypos = NA,
+ snames = NA, cexuk = 1.1)
+legend("topleft", legend = soils.sw.names, col = 1:max(soils.sw.cols),
+ pch = 16, cex = 1.1, title = "Location", bty = "n")
+fpkids<-data.frame(Food=c("Fatty/sugary","Fruit","Starchy","Meat",
+ "Proc.meat","Eggs","Fish","Dairy","Vegetables"),
+ Female=c(4.21,4.22,3.98,3.57,3.55,3.46,3.34,3.26,3.13),
+ Male=c(4.35,4.13,4.02,3.9,3.81,3.64,3.45,3.27,2.96))
+plot(rep(1,9),fpkids$Female,xlim=c(0.8,2.2),
+ ylim=range(c(fpkids$Female,fpkids$Male)),xlab="Sex",xaxt="n",
+ ylab="Mean preference rating",main="Children's food preferences by sex",
+ col="red")
+axis(1,at=1:2,labels=c("Female","Male"))
+points(rep(2,9),fpkids$Male,col="blue",pch=2)
+spread.labels(rep(1:2,each=9),c(fpkids$Female,fpkids$Male),
+ fpkids$Food,between=TRUE,linecol=c("red","blue"))
+testx<-matrix(abs(rnorm(100)),nrow=10)
+stackpoly(matrix(cumsum(testx),nrow=10),main="Test Stackpoly I",
+ xaxlab=c("One","Two","Three","Four","Five",
+ "Six","Seven","Eight","Nine","Ten"),border="black",staxx=TRUE)
+sample_size<-c(500,-72,428,-94,334,-45,289)
+totals<-c(TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE)
+labels<-c("Contact list","Uncontactable","","Declined","","Ineligible",
+ "Final sample")
+staircase.plot(sample_size,totals,labels,
+ main="Acquisition of the sample (staircase.plot)",
+ total.col="gray",inc.col=2:4,bg.col="#eeeebb",direction="s")
+ date_mat<-data.frame(sex=rep(c("M","F"),each=10),
+  names=c("Abe","Bob","Col","Dave","Eddie","Frank","Geoff","Harry","Igor","Jack",
+  "Alice","Betty","Clare","Dora","Eva","Fran","Grace","Hilda","Iris","Joan"),
+  eating=sample(0:100,20),dancing=sample(0:100,20),movies=sample(0:100,20),
+  reading=sample(0:100,20),travel=sample(0:100,20))
+par(mar=c(5,4,4,2))
+ plot(0,xlim=c(0.5,10.5),ylim=c(0,3),type="n",axes=FALSE,xlab="",ylab="Sex",
+  main="Date matching matrix")
+ par(xpd=TRUE)
+ legend(0.7,-0.2,c("Eat out","Dance","Movies","Read","Travel"),fill=rainbow(5),
+  ncol=5)
+ par(xpd=FALSE)
+ box()
+ axis(2,at=c(0.9,2.4),labels=c("Male","Female"))
+ starPie(x=rep(1:10,2),y=rep(c(0.9,2.4),each=10),radext=0.5,
+  values=as.matrix(date_mat[,3:7]),label=as.character(date_mat[["names"]]))
+x<-rnorm(20)
+y<-rnorm(20)
+xlim<-range(x)
+xspace<-(xlim[2]-xlim[1])/20
+xlim<-c(xlim[1]-xspace,xlim[2]+xspace)
+ylim<-range(y)
+yspace<-(ylim[2]-ylim[1])/20
+ylim<-c(ylim[1]-yspace,ylim[2]+yspace)
+plotlabels<-
+ c("one","two","three","four","five","six","seven","eight","nine","ten",
+ "eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen",
+ "eighteen","nineteen","twenty")
+plot(x=x,y=y,xlim=xlim,ylim=ylim,main="Test thigmophobe.labels")
+thigmophobe.labels(x,y,plotlabels,col=c(2:6,8:12))
+data(soils)
+triax.retval<-triax.plot(soils[1:6,],main="Test triax.plot",
+ show.grid=TRUE,show.legend=TRUE,col.symbols=1:6,pch=4)
+par(triax.retval$oldpar)
+twoord.plot(2:10,seq(3,7,by=0.5)+rnorm(9),
+ 1:15,rev(60:74)+rnorm(15),lylim=c(2,15),rylim=c(40,75),
+ rytickpos=seq(60,75,by=5),lytickpos=2:7,
+ xlab="Sequence",ylab="Ascending values",rylab="Descending values")
+tab.title("Test of twoord.plot and tab.title",tab.col="yellow",radius=0.5)
+o<-matrix(rep(pi*seq(0.1,0.8,by=0.1),7),ncol=8,byrow=TRUE)
+m<-matrix(rnorm(56)+4,ncol=8,byrow=TRUE)
+plot(0,xlim=c(0.7,8.3),ylim=c(0.7,7.3),type="n",xlab="Longitude",
+ ylab="Latitude",main="Test vector.field with lengthKey")
+vectorField(o,m,vecspec="rad")
+lengthKey(0.3,-0.5,c(0,5,10),0.24)
+zoomInPlot(rnorm(100),rnorm(100),rxlim=c(-1,1),rylim=c(-1,1),
+ zoomtitle="Zoom In Plot",titlepos=-1.5)
+readline("End of demo, press <Enter>")
+par(ask=FALSE)
+dev.off()
+
diff --git a/inst/CITATION b/inst/CITATION
new file mode 100755
index 0000000..125aa74
--- /dev/null
+++ b/inst/CITATION
@@ -0,0 +1,12 @@
+citHeader("To cite package 'plotrix' in publications use:")
+citEntry(entry="Article",
+ year = 2006,
+ title = "Plotrix: a package in the red light district of R",
+ journal = "R-News",
+ volume = "6",
+ number = "4",
+ pages = "8-12",
+ author = personList(as.person("Lemon J")),
+ textVersion = "Lemon, J. (2006) Plotrix: a package in the red light
+  district of R. R-News, 6(4): 8-12."
+)
diff --git a/man/ablineclip.Rd b/man/ablineclip.Rd
new file mode 100755
index 0000000..37dd781
--- /dev/null
+++ b/man/ablineclip.Rd
@@ -0,0 +1,47 @@
+\name{ablineclip}
+\alias{ablineclip}
+\title{Add a straight line to a plot}
+\description{
+  As \samp{abline}, but has arguments \samp{x1,x2,y1,y2} as in \samp{clip}.
+}
+\usage{
+ ablineclip(a=NULL,b=NULL,h=NULL,v=NULL,reg=NULL,coef=NULL,untf=FALSE,
+  x1=NULL,x2=NULL,y1=NULL,y2=NULL,...)
+}
+\arguments{
+ \item{a}{Intercept.}
+ \item{b}{Slope.}
+ \item{h}{the x-value(s) for vertical line(s).}
+ \item{v}{the y-value(s) for horizontal line(s).}
+ \item{reg}{Fitted lm object. }
+ \item{coef}{Coefficients, typically intercept and slope.}
+ \item{untf}{How to plot on log coordinates, see \samp{abline}.}
+ \item{x1,x2,y1,y2}{Clipping limits, see \samp{clip}.}
+ \item{...}{Further arguments passed to \samp{abline}.}
+}
+\details{
+ \samp{ablineclip} sets a new clipping region and then calls \samp{abline}.
+ If any of the four clipping limits is NULL, the values from \samp{par("usr")}
+ are substituted. After the call to \samp{abline}, the old clipping region
+ is restored. In order to make \samp{clip} work, there is a call to \samp{abline}
+ that draws a line off the plot.
+
+ Multiple lines of the same type can be drawn in a single call, but the clipping
+ region must be the same for each group of lines. Thanks to Berry Boessenkool
+ for pointing this out.
+}
+\value{
+ None. Adds to the current plot.
+}
+\author{ Remko Duursma }
+\seealso{\link{abline}, \link{clip}}
+\examples{
+ x <- rnorm(100)
+ y <- x + rnorm(100)
+ lmfit <- lm(y~x)
+ plot(x, y, xlim=c(-3.5, 3.5))
+ ablineclip(lmfit, x1 = -2, x2 = 2, lty = 2)
+ ablineclip(h = 0, x1 = -2,x2 = 2,lty = 3, col = "red")
+ ablineclip(v = 0, y1 = -2.5, y2 = 1.5, lty=4, col = "green")
+}
+\keyword{ aplot }
\ No newline at end of file
diff --git a/man/add.ps.Rd b/man/add.ps.Rd
new file mode 100644
index 0000000..35252f4
--- /dev/null
+++ b/man/add.ps.Rd
@@ -0,0 +1,116 @@
+\name{add.ps}
+\alias{add.ps}
+\title{
+add p-values from t-tests
+}
+\description{
+ Adds p-values comparing the different cells at each x-axis position with a
+ reference cell. Uses a syntax similar to \samp{raw.means.plot2}.
+}
+\usage{
+ add.ps(data, col.id, col.offset, col.x, col.value, fun.aggregate = "mean",
+ ref.offset = 1, prefixes,alternative = c("two.sided", "less", "greater"),
+ mu = 0, paired = FALSE, var.equal = FALSE, lty = 0, ...)
+}
+\arguments{
+  \item{data}{
+A \samp{data.frame}
+}
+  \item{col.id}{
+\samp{character} vector specifying the id column.
+}
+  \item{col.offset}{
+\samp{character} vector specifying the offset column.
+}
+  \item{col.x}{
+\samp{character} vector specifying the x-axis column.
+}
+  \item{col.value}{
+\samp{character} vector specifying the data column.
+}
+ \item{fun.aggregate}{
+Function or function name used for aggregating the results. Default is
+ \samp{"mean"}.
+}
+  \item{ref.offset}{
+ Scalar \samp{numeric} indicating the reference level to be tested against.
+ The default is 1 corresponding to \samp{levels(factor(d[,col.offset]))[1]}.
+}
+  \item{prefixes}{
+\samp{character} vector of the indices for the p-values. If missing
+ corresponds to \samp{levels(factor(d.new[,col.offset]))[-ref.offset]}. 
+}
+  \item{alternative}{
+same as in \link{t.test}
+}
+  \item{mu}{
+same as in \link{t.test}
+}
+  \item{paired}{
+same as in \link{t.test}
+}
+  \item{var.equal}{
+same as in \link{t.test}
+}
+  \item{lty}{
+line type of axis, Default is 0 (i.e., no line).
+}
+  \item{\dots}{
+further arguments passed to axis.
+}
+}
+\details{
+This function computes t-tests comparing the values at each x-axis position
+ for each condition against the reference condition at and adds the p-values
+ to the axis.
+
+This functions uses the same syntax as \link{raw.means.plot2} and
+ should be used in addition to it. Note that values are ordered according to
+ the \samp{col.id} so \samp{paired = TRUE} should be fine.
+}
+\value{
+axis is plotted.
+}
+\author{
+Henrik Singmann
+}
+
+
+\seealso{
+ \link{raw.means.plot} as the accompanying main functions.
+}
+\examples{
+\dontrun{
+#The examples uses the OBrienKaiser dataset from car and needs reshape.
+# This extends the examples from raw.means.plot
+require(reshape)
+require(car)
+data(OBrienKaiser)
+OBKnew <- cbind(factor(1:nrow(OBrienKaiser)), OBrienKaiser)
+colnames(OBKnew)[1] <- "id"
+OBK.long <- melt(OBKnew)
+OBK.long[, c("measurement", "time")] <-
+ t(vapply(strsplit(as.character(OBK.long$variable), "\\\."),  "[", c("", "")))
+
+# For this example the position at each x-axis are within-subject comparisons!
+raw.means.plot2(OBK.long, "id", "measurement", "gender", "value")
+ add.ps(OBK.long, "id", "measurement", "gender", "value", paired = TRUE)
+ #reference is "fup"
+
+raw.means.plot2(OBK.long, "id", "measurement", "gender", "value")
+add.ps(OBK.long, "id", "measurement", "gender", "value", ref.offset = 2,
+ paired = TRUE) #reference is "post"
+
+# Use R's standard (i.e., Welch test)
+raw.means.plot2(OBK.long, "id", "treatment", "gender", "value")
+add.ps(OBK.long, "id", "treatment", "gender", "value",
+ prefixes = c("p(control vs. A)", "p(control vs. B)"))
+
+# Use standard t-test
+raw.means.plot2(OBK.long, "id", "treatment", "gender", "value")
+add.ps(OBK.long, "id", "treatment", "gender", "value", var.equal = TRUE,
+ prefixes = c("p(control vs. A)", "p(control vs. B)"))
+
+}
+}
+
diff --git a/man/addtable2plot.Rd b/man/addtable2plot.Rd
new file mode 100755
index 0000000..62082e6
--- /dev/null
+++ b/man/addtable2plot.Rd
@@ -0,0 +1,59 @@
+\name{addtable2plot}
+\alias{addtable2plot}
+\title{Add a table of values to a plot}
+\description{
+ Displays a table of values at a user-specified position on an existing plot}
+\usage{
+ addtable2plot(x,y=NULL,table,lwd=par("lwd"),bty="n",bg=par("bg"),
+  cex=1,xjust=0,yjust=1,xpad=0.1,ypad=0.5,box.col=par("fg"),text.col=par("fg"),
+  display.colnames=TRUE,display.rownames=FALSE,hlines=FALSE,vlines=FALSE,
+  title=NULL)
+}
+\arguments{
+ \item{x,y}{Either x and y coordinates to locate the table or an
+  \samp{xy.coords} object.}
+ \item{table}{A data frame, matrix or similar object that will be displayed.}
+ \item{lwd}{The line width for the box and horizontal dividers.}
+ \item{bty}{Whether to draw a box around the table ("o") or not ("n").}
+ \item{bg}{The background color for the table.}
+ \item{cex}{Character expansion for the table.}
+ \item{xjust,yjust}{Positioning for the table relative to \samp{x,y}.}
+ \item{xpad,ypad}{The amount of padding around text in the cells as a
+  proportion of the maximum width and height of the strings in each column.}
+ \item{box.col}{The color for the box and lines.}
+ \item{text.col}{The color for the text.}
+ \item{display.colnames}{Whether to display the column names in the table.}
+ \item{display.rownames}{Whether to display the row names in the table.}
+ \item{hlines}{Whether to draw horizontal lines between each row of the table.}
+ \item{vlines}{Whether to draw vertical lines between each column of the table.}
+ \item{title}{Optional title placed over the table.}
+}
+\value{nil}
+\details{
+ \samp{addtable2plot} displays the values in \samp{table} at a position in user
+ coordinates specified by \samp{x,y}. The two justification arguments,
+ \samp{xjust} and \samp{yjust} are the same as in the \samp{legend} function,
+ and \samp{addtable2plot} has been programmed to be as similar to \samp{legend}
+ as possible. The function now accepts the positional arguments such as
+ "topright" if passed as \samp{x}. The defaults are those that were most
+ popular in scientific journals at the time of programming.
+
+ If \samp{bg} is a matrix of colors of the same dimensions as \samp{x}, those
+ colors will be the backgrounds of the cells. The default is no background color.
+}
+\author{Original by John Kane, mods by Jim Lemon and Brian Diggs. Thanks to
+ Andrija Djurovic for asking for the individual cell colors and Gabor Grothendieck
+ for alerting me to the problem of widely varying column widths.}
+\seealso{\link{legend}}
+\examples{
+ testdf <- data.frame(Before = c(10, 7, 5, 9), During = c(8, 6, 2, 5),
+  After = c(5, 3, 4, 3))
+ rownames(testdf) <- c("Red", "Green", "Blue", "Lightblue")
+ barp(testdf, main = "Test addtable2plot", ylab = "Value",
+  names.arg = colnames(testdf), col = 2:5)
+ # show most of the options including the christmas tree colors
+ abg <- matrix(c(2, 3, 5, 6, 7, 8), nrow=4, ncol=3)
+ addtable2plot(2, 8, testdf, bty = "o", display.rownames = TRUE, hlines = TRUE,
+  vlines = TRUE, title = "The table", bg = abg)
+}
+\keyword{misc}
diff --git a/man/arctext.Rd b/man/arctext.Rd
new file mode 100755
index 0000000..ad82d3c
--- /dev/null
+++ b/man/arctext.Rd
@@ -0,0 +1,55 @@
+\name{arctext}
+\title{Display text on a circular arc}
+\description{Displays a character string on the circumference of an imaginary
+ circle on an existing plot.}
+\usage{
+ arctext(x,center=c(0,0),radius=1,start=NA,middle=pi/2,end=NA,stretch=1,
+ clockwise=TRUE,cex=NA,...)
+}
+\alias{arctext}
+\arguments{
+ \item{x}{A character string.}
+ \item{center}{The center of the circular arc in x/y user units.}
+ \item{radius}{The radius of the arc in user units.}
+ \item{start}{The starting position of the string in radians.}
+ \item{middle}{The middle position of the string in radians.}
+ \item{end}{The end position of the string in radians.}
+ \item{stretch}{How much to stretch the string for appearance.}
+ \item{clockwise}{Whether to print the string in the clockwise direction.}
+ \item{cex}{The character expansion factor.}
+ \item{...}{additional arguments passed to \samp{text}.}
+}
+\details{
+ \samp{arctext} displays a string along a circular arc, rotating each
+ letter. This may not work on all devices, as not all graphic devices
+ can rotate text to arbitrary angles. The output looks best on a 
+ Postscript or similar device that can rotate text without distortion.
+ Rotated text often looks very ragged on small bitmaps.
+ 
+ If the user passes a value for
+ \samp{start}, this will override any value passed to \samp{middle}.
+ If the plot area is not square, see \samp{par(pty="s")}, the arc will
+ be somewhat elliptical.
+
+ If the \samp{clockwise} argument is TRUE, the string will be displayed
+ in a clockwise direction and the orientation of the characters will be
+ rotated \samp{pi} radians (180 degrees). This is useful when the string
+ is to be displayed on the bottom of the circumference.
+}
+\value{nil}
+\author{Jim Lemon - Thanks to Suhas Parandekar for the idea, Ted Toal
+ for greatly improving the placement of the text and Andy South for
+ providing the initial code for the clockwise argument.}
+\seealso{\link{text}}
+\examples{
+ plot(0, xlim = c(1, 5),ylim = c(1, 5),main = "Test of arctext", xlab = "",
+  ylab = "", type = "n")
+ arctext("bendy like spaghetti", center = c(3,3), col = "blue")
+ arctext("bendy like spaghetti", center = c(3,3), radius = 1.5, start = pi,
+  cex = 2)
+ arctext("bendy like spaghetti", center = c(3, 3),radius = 0.5,
+  start = pi/2, stretch = 1.2)
+ arctext("bendy like spaghetti", center = c(3, 3), radius = 1.7,
+  start = 4 * pi / 3, cex = 1.3, clockwise = FALSE)
+}
+\keyword{misc}
diff --git a/man/axis.break.Rd b/man/axis.break.Rd
new file mode 100755
index 0000000..8038c1d
--- /dev/null
+++ b/man/axis.break.Rd
@@ -0,0 +1,47 @@
+\name{axis.break}
+\alias{axis.break}
+\title{ Place a "break" mark on an axis }
+\description{
+ Places a "break" mark on an axis on an existing plot.
+}
+\usage{
+ axis.break(axis=1,breakpos=NULL,pos=NA,bgcol="white",breakcol="black",
+  style="slash",brw=0.02)
+}
+\arguments{
+ \item{axis}{which axis to break}
+ \item{breakpos}{where to place the break in user units}
+ \item{pos}{position of the axis (see \link{axis}).}
+ \item{bgcol}{the color of the plot background}
+ \item{breakcol}{the color of the "break" marker}
+ \item{style}{Either \samp{gap}, \samp{slash} or \samp{zigzag}}
+ \item{brw}{break width relative to plot width}
+}
+\value{nil}
+\details{
+ The \samp{pos} argument is not needed unless the user has specified a
+ different position from the default for the axis to be broken.
+}
+\note{
+ There is some controversy about the propriety of using discontinuous
+ coordinates for plotting, and thus axis breaks. Discontinuous coordinates
+ allow widely separated groups of values or outliers to appear without
+ devoting too much of the plot to empty space. The major objection seems 
+ to be that the reader will be misled by assuming continuous coordinates.
+ The \samp{gap} style that clearly separates the two sections of the plot
+ is probably best for avoiding this.
+}
+\author{Jim Lemon and Ben Bolker}
+\seealso{\link{gap.plot}}
+\examples{
+ plot(3:10, main = "Axis break test")
+ # put a break at the default axis and position
+ axis.break()
+ axis.break(2, 2.9, style = "zigzag")
+ twogrp <- c(rnorm(10) + 4, rnorm(10) + 20)
+ gap.plot(twogrp,gap = c(8,16), xlab = "Index", ylab = "Group values",
+  main = "Two separated groups with gap axis break",
+  col = c(rep(2, 10), rep(3, 10)), ytics = c(3, 5, 18, 20))
+ legend(12, 6, c("Low group", "High group"), pch = 1, col = 2:3)
+}
+\keyword{misc}
diff --git a/man/axis.mult.Rd b/man/axis.mult.Rd
new file mode 100755
index 0000000..a85b2aa
--- /dev/null
+++ b/man/axis.mult.Rd
@@ -0,0 +1,47 @@
+\name{axis.mult}
+\alias{axis.mult}
+\title{ Display an axis with values having a multiplier }
+\description{
+ An axis is displayed on an existing plot where the tick values are divided
+ by a multiplier and the multiplier is displayed next to the axis.
+}
+\usage{
+ axis.mult(side=1,at=NULL,labels,mult=1,mult.label,mult.line,
+  mult.labelpos=NULL,...)
+}
+\arguments{
+ \item{side}{which side to display}
+ \item{at}{where to place the tick marks - defaults to \samp{axTicks()}}
+ \item{labels}{tick labels - defaults to at/mult}
+ \item{mult}{the multiplier factor}
+ \item{mult.label}{the label to show the multiplier - defaults to "x mult"}
+ \item{mult.line}{the margin line upon which to show the multiplier}
+ \item{mult.labelpos}{where to place \samp{mult.label} - defaults to centered
+  and outside the axis tick labels}
+ \item{...}{additional arguments passed to \samp{axis}.}
+}
+\value{nil}
+\details{
+ \samp{axis.mult} automates the process of displaying an axis with a 
+ multiplier applied to the tick values. By default it will divide the
+ default axis tick labels by \samp{mult} and place \samp{mult.label}
+ where \samp{xlab} or \samp{ylab} would normally appear. Thus the plot
+ call should set the relevant label to an empty string in such cases.
+ It is simplest to call \samp{plot} with \samp{axes=FALSE} and then 
+ display the box and any standard axes before calling \samp{axis.mult}.
+}
+\note{
+ While \samp{axis.mult} will try to display an axis on any side, the top
+ and right margins will require adjustment using \samp{par} for
+ \samp{axis.mult} to display properly.
+}
+\author{Jim Lemon}
+\seealso{\link{axis}, \link{mtext}}
+\examples{
+ plot(1:10 * 0.001, 1:10 * 100,axes = FALSE, xlab = "", ylab = "",
+  main = "Axis multipliers")
+ box()
+ axis.mult(1, mult = 0.001)
+ axis.mult(2, mult = 100)
+}
+\keyword{misc}
diff --git a/man/barNest.Rd b/man/barNest.Rd
new file mode 100755
index 0000000..62bc2c5
--- /dev/null
+++ b/man/barNest.Rd
@@ -0,0 +1,159 @@
+\name{barNest}
+\alias{barNest}
+\title{Display a nested breakdown of numeric values}
+\description{Breaks down the elements of a data frame by one or more
+ categorical elements and displays the breakdown as a bar plot.}
+\usage{
+ barNest(formula=NULL,data=NULL,FUN=c("mean","sd","sd","valid.n"),ylim=NULL,
+ main="",xlab="",ylab="",shrink=0.1,errbars=FALSE,col=NA,
+ labelcex=1,lineht=NA,showall=TRUE,Nwidths=FALSE,barlabels=NULL,
+ showlabels=TRUE,mar=NULL,arrow.cap=NA,trueval=TRUE)
+}
+\arguments{
+ \item{formula}{A formula with a numeric element of a data frame on the left and
+  one or more categorical elements on the right.}
+ \item{data}{A data frame containing the elements in \samp{formula}.}
+ \item{FUN}{The functions to apply to x.}
+ \item{ylim}{Optional y limits for the plot, usually necessary for counts.}
+ \item{main}{Title for the plot.}
+ \item{xlab,ylab}{Axis labels for the plot. The x axis label is typically blank}
+ \item{shrink}{The proportion to shrink the width of the bars at each level.}
+ \item{errbars}{Whether to display error bars on the lowest level of breakdown.}
+ \item{col}{The colors to use to fill the bars. See Details.}
+ \item{labelcex}{Character size for the group labels.}
+ \item{lineht}{The height of a line of text in the lower margin of the plot in user
+  units. This will be calculated by the function if a value is not passed.}
+ \item{showall}{Whether to display bars for the entire breakdown.}
+ \item{Nwidths}{Whether to scale the widths of the bars to the number of
+  observations.}
+ \item{barlabels}{Optional group labels that may be useful if the factors used to
+  break down the numeric variable are fairly long strings.}
+ \item{showlabels}{Whether to display the labels below the bars.}
+ \item{mar}{If not NULL, a four element vector to set the plot margins. If new
+  margins are set, the user must reset the margins after the function exits.}
+ \item{arrow.cap}{The width of the "cap" on error bars in user units,
+  calculated on the basis of the number of bars in the final breakdown if NA.}
+ \item{trueval}{If this is not NA, the call to \samp{brkdnNest} will return the
+  proportions of the response variable that are equal to \samp{trueval}.
+  See Details.}
+}
+\value{The summary list produced by brkdnNest.}
+\details{
+ \samp{barNest} displays a bar plot illustrating the hierarchic breakdown of
+ the elements of a data frame. The breakdown is performed by \samp{brkdnNest}
+ and the actual display is performed by \samp{drawNestedBars}. The heights of
+ the bars will be proportional to the values returned by the first function in
+ \samp{FUN}. If \samp{showall} is TRUE, the entire nested breakdown will be
+ displayed. This can be useful in visualizing the relationship between groups
+ and subgroups in a compact format.
+
+ \samp{barNest} assumes that there will be four breakdowns in the list
+ returned by \samp{brkdnNest} in the order summary measure, upper dispersion
+ value, lower dispersion value and number of valid observations. If
+ \samp{Nwidths=FALSE}, it may work with only three and if \samp{errbars=FALSE}
+ as well, it may work with only one.
+
+ If \samp{Nwidths=TRUE}, the bar widths will be scaled to the relative number
+ of observations per group. When the numbers of observations are very different,
+ the labels for those bars with small numbers of observations will probably
+ overlap.
+
+ A number of functions can be passed in the \samp{FUN} argument. Three
+ functions, \samp{propbrk}, \samp{sumbrk} and \samp{valid.n} will work as
+ summary measures, giving proportions or sums of particular values of a
+ discrete variable and counts in each group and subgroup respectively.
+ Binomial confidence limits can be added to the proportions returned by
+ \samp{propbrk} with \samp{binciWl} and \samp{binciWu} as in the second last
+ example. If \samp{valid.n} is the first element of \samp{FUN}, the "overall"
+ bar and label will be suppressed, as they are not informative. It is up to
+ the user to decide whether any "error bars" displayed are meaningful.
+
+ The colors of the bars are determined by \samp{col}. If \samp{showall} is
+ FALSE, the user only need pass a vector of colors, usually the same length
+ as the number of categories in the final (last on the right side) element in
+ the formula. If \samp{showall} is TRUE and the user wants to color all of the
+ bars, a list with as many elements as there are levels in the breakdown
+ should be passed. Each element should be a vector of colors, again usually
+ the same length as the number of categories. As the categorical variables are
+ likely to be factors, it is important to remember that the colors must be in
+ the correct order for the levels of the factors. When the levels are not in
+ the default alphanumeric order, it is quite easy to get this wrong. As a
+ \samp{barNest} plot with more than a few factors and levels in each factor is
+ quite dense, easily distinguished colors for each level of the breakdown may
+ be preferable. As with some other plots, trying to cram too much information
+ into a single illustration may not work well.
+}
+\author{Jim Lemon and Ofir Levy}
+\references{
+ Lemon, J. & Levy, O. (2011) barNest: Illustrating nested summary measures.
+ Statistical Computing and Graphics Newsletter of the American Statistical
+ Association, 21(2): 5-10.
+}
+\seealso{\link{brkdnNest}, \link{drawNestedBars}, superbarplot(UsingR)}
+\examples{
+ # recreate the Titanic data frame and show the three way breakdown
+ titanic<-data.frame(
+  class=c(rep("1st",325),rep("2nd",285),rep("3rd",706),rep("Crew",885)),
+  age=c(rep("Adult",319),rep("Child",6),rep("Adult",261),rep("Child",24),
+  rep("Adult",627),rep("Child",79),rep("Adult",885)),
+  sex=c(rep("M",175),rep("F",144),rep("M",5),rep("F",1),
+  rep("M",168),rep("F",93),rep("M",11),rep("F",13),
+  rep("M",462),rep("F",165),rep("M",48),rep("F",31),
+  rep("M",862),rep("F",23)),
+  survived=c(rep("Yes",57),rep("No",118),rep("Yes",140),rep("No",4),rep("Yes",6),
+  rep("Yes",14),rep("No",154),rep("Yes",80),rep("No",13),rep("Yes",24),
+  rep("Yes",75),rep("No",387),rep("Yes",76),rep("No",89),
+  rep("Yes",13),rep("No",35),rep("Yes",14),rep("No",17),
+  rep("Yes",192),rep("No",670),rep("Yes",20),rep("No",3)))
+ require(plotrix)
+ titanic.colors<-list("gray90",c("#0000ff","#7700ee","#aa00cc","#dd00aa"),
+  c("#ddcc00","#ee9900"),c("pink","lightblue"))
+ barNest(survived~class+age+sex,titanic,col=titanic.colors,showall=TRUE,
+  main="Titanic survival by class, age and sex",ylab="Proportion surviving",
+  FUN=c("propbrk","binciWu","binciWl","valid.n"),shrink=0.15,trueval="Yes")
+ barNest(survived~class+age+sex,titanic,col=titanic.colors,showall=TRUE,
+  main="Titanic survival by class, age and sex (scaled bar widths)",
+  ylab="Proportion surviving",FUN=c("propbrk","binciWu","binciWl","valid.n"),
+  shrink=0.15,trueval="Yes",Nwidths=TRUE)
+ # now show the actual numbers of passengers
+ barNest(survived~class+age+sex,titanic,col=titanic.colors,showall=TRUE,
+  main="Titanic passengers and crew by class, age and sex",
+  ylab="Number",FUN="valid.n",shrink=0.15)
+ # to see this properly displayed, start a wide plot window
+ # x11(width=10)
+ test.df<-data.frame(Age=rnorm(100,35,10),
+  Sex=sample(c("Male","Female"),100,TRUE),
+  Marital=sample(c("Div","Mar","Sing","Wid"),100,TRUE),
+  Employ=sample(c("FT","PT","Un"),100,TRUE))
+ test.col<-list(Overall="gray",Sex=c("pink","lightblue"),
+  Marital=c("mediumpurple","orange","tan","lightgreen"),
+  Employ=c("#1affd8","#caeecc","#ff90d0"))
+ barNest(formula=Age~Sex+Marital+Employ,data=test.df,ylab="Mean age (years)",
+  main="Mean age by subgroups",errbars=TRUE,col=test.col)
+ barNest(formula=Age~Sex+Marital+Employ,data=test.df,ylab="Mean age (years)",
+  main="Mean age by subgroups (widths scaled to Ns)",errbars=TRUE,col=test.col,
+  Nwidths=TRUE)
+ # set up functions for 20th and 80th percentiles
+ q20<-function(x,na.rm=TRUE) return(quantile(x,probs=0.2,na.rm=TRUE))
+ q80<-function(x,na.rm=TRUE) return(quantile(x,probs=0.8,na.rm=TRUE))
+ # show the asymmetric dispersion measures
+ barNest(formula=Age~Sex+Marital+Employ,data=test.df,ylab="Mean age (years)",
+  main="Use median and quantiles for dispersion",
+  FUN=c("median","q80","q20","valid.n"),
+  errbars=TRUE,col=test.col)
+ barNest(formula=Employ~Sex+Marital,data=test.df,ylab="Proportion unemployed",
+  main="Proportion unemployed by sex and marital status",
+  FUN=c("propbrk","binciWu","binciWl","valid.n"),
+  errbars=TRUE,col=test.col,trueval="Un")
+ barNest(formula=Employ~Sex+Marital,data=test.df,ylab="Proportion unemployed",
+  main="Proportion unemployed by sex and marital status (scaled bar widths)",
+  FUN=c("propbrk","binciWu","binciWl","valid.n"),
+  errbars=TRUE,col=test.col,trueval="Un",Nwidths=TRUE)
+ barNest(formula=Age~Sex+Marital+Employ,data=test.df,ylab="Counts",
+  main="Show the counts in subgroups (final level only)",FUN="valid.n",
+  col=test.col,showall=FALSE,ylim=c(0,10))
+ barNest(formula=Age~Sex+Marital+Employ,data=test.df,ylab="Counts",
+  main="Show all the counts in subgroups",FUN="valid.n",mar=c(5,5,4,2),
+  col=test.col)
+ }
+\keyword{misc}
diff --git a/man/barlabels.Rd b/man/barlabels.Rd
new file mode 100644
index 0000000..4b8c811
--- /dev/null
+++ b/man/barlabels.Rd
@@ -0,0 +1,45 @@
+\name{barlabels}
+\alias{barlabels}
+\title{Label the bars on a barplot}
+\description{Displays labels on a plot, usually a bar plot.}
+\usage{
+ barlabels(xpos,ypos,labels=NULL,cex=1,prop=0.5,miny=0,offset=0,...)
+}
+\arguments{
+ \item{xpos}{A vector, matrix or data frame of x positions for the labels.}
+ \item{ypos}{A vector, matrix or data frame of y positions for the labels.}
+ \item{labels}{The labels to display. Defaults to the values of y.}
+ \item{cex}{Relative size of the labels. See \samp{text}.}
+ \item{prop}{The proportion of \samp{ypos} at which to place the labels.
+  Defaults to 0.5 (the middle).}
+ \item{miny}{The minimum value at which to display labels.}
+ \item{offset}{Amount to horizontally offset successive labels in case
+  of vertical overlaps.}
+ \item{...}{Extra arguments passed to \samp{boxed.labels}.}
+}
+\details{
+ \samp{barlabels} places labels on a plot at horizontal positions \samp{xpos}
+ and vertical positions \samp{ypos} * \samp{pos}. The typical use of this
+ function is to place labels on bars, by default in the middle of the bars.
+
+ To put labels just over the tops of the bars, set \samp{prop} to 1 and add a
+ constant amount to \samp{ypos}.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{boxed.labels}}
+\examples{
+ heights<-c(14,20,9,31,17)
+ barpos<-barplot(heights,main="A redundant bar plot")
+ # show the usual value labels on the bars
+ barlabels(barpos,heights)
+ # now with stacked bars and offsets
+ heights<-matrix(sample(c(1,2,10,15),20,TRUE),ncol=4)
+ barpos<-barplot(heights,main="Another redundant bar plot")
+ barlabels(barpos,heights,offset=0.1)
+ # finally use barp for the plot
+ barpos<-barp(heights,main="A third and final bar plot",col=2:6,
+  names.arg=paste("Day",1:4))
+ barlabels(barpos$x,barpos$y,matrix(LETTERS[1:5],nrow=5,ncol=4))
+}
+\keyword{misc}
diff --git a/man/barp.Rd b/man/barp.Rd
new file mode 100755
index 0000000..65caf3e
--- /dev/null
+++ b/man/barp.Rd
@@ -0,0 +1,151 @@
+\name{barp}
+\alias{barp}
+\title{A bar plotting routine}
+\description{Display a bar plot}
+\usage{
+ barp(height,width=0.4,names.arg=NULL,legend.lab=NULL,legend.pos=NULL,
+ col=NULL,border=par("fg"),main=NULL,xlab="",ylab="",xlim=NULL,ylim=NULL,
+ x=NULL,staxx=FALSE,staxy=FALSE, height.at=NULL,height.lab=NULL,
+ cex.axis=par("cex.axis"),pch=NULL,cylindrical=FALSE,shadow=FALSE,
+ do.first=NULL,ylog=FALSE,srt=NA)
+}
+\arguments{
+ \item{height}{A numeric vector, matrix or data frame that will be represented
+  as the heights of bars.}
+ \item{width}{Half the width of a single bar or group of bars in X axis units.}
+ \item{names.arg}{The labels for the bars or groups of bars.}
+ \item{legend.lab}{Labels for an optional legend. If NULL, no legend is
+  displayed.}
+ \item{legend.pos}{Optional position for the legend as a list with \samp{x}
+  and \samp{y} components. If this is NULL, \samp{locator} will be called.}
+ \item{col}{The fill colors for the bars. The default is no fill.}
+ \item{border}{The border for the bars.}
+ \item{main}{The title at the top of the plot.}
+ \item{xlab,ylab}{The labels for the X and Y axes respectively.}
+ \item{xlim,ylim}{Optional horizontal and vertical limits for the plot.}
+ \item{x}{Optional horizontal positions for the bars. Defaults to 1:length(height).} 
+\item{staxx,staxy}{Whether to use \link{staxlab} to stagger the 
+  X or Y axis tick labels.}
+ \item{height.at}{Optional positions of the tick marks on the Y axis.}
+ \item{height.lab}{Optional tick labels for the Y axis.}
+ \item{cex.axis}{Character expansion for the axis labels.}
+ \item{pch}{Symbol(s) to fill the bars. See Details.}
+ \item{cylindrical}{Whether to give the bars a cylindrical appearance
+  by shading them.}
+ \item{shadow}{Whether to place a shadow behind the bars.}
+ \item{do.first}{An optional string that will be evaluated before anything
+  else is displayed on the plot. Useful for background colors or lines.}
+ \item{ylog}{Logical for whether a log scale is to be used. see details.}
+ \item{srt}{Rotation of axis labels if staxx or staxy is TRUE (see \samp{staxlab}).}
+}
+\value{
+ A list containing two components of the same form as \samp{height}:
+ \item{x}{The centers of the bars displayed.}
+ \item{y}{The heights of the bars.}
+}
+\details{
+ \samp{barp} displays a bar plot similar to \samp{barplot} but with axes and
+ horizontal bar positions more like \samp{plot}. Bars or groups of bars are
+ centered on integral X values by default, and so both the width and spacing of
+ the bars are controlled by a single number. If the user passes explicit \samp{x}
+ values, those values will determine the spacing. If \samp{height} is a vector,
+ single bars representing each value will be displayed centered at
+ \samp{1:length(height)} unless the user has specified \samp{x} values.
+ If \samp{height} is a matrix, 2D array, or data frame, a group of bars will be
+ drawn for each column, with the values of the group taken from the rows of that
+ column. Explicit x values cannot be used with a matrix, however, by adjusting the
+ values of x, grouped bars can be displayed.
+
+ The values from \samp{freq} or \samp{brkdn} in the prettyR package can
+ be used as the \samp{height} argument. The value from \samp{table} can also be
+ passed as \samp{height}, as can a 2D array returned from the \samp{by} function.
+ 
+ Bars are empty by default but fill colors can be defined in several ways.
+ If a single color is passed, all bars will be the same color. If \samp{height}
+ is a vector, colors will be recycled or some will be ignored if the length of
+ \samp{col} is
+ not equal to that of \samp{height}. If \samp{height} is a matrix or data frame,
+ the user may pass a vector of colors equal to the number of rows in \samp{height}
+ or a matrix of colors of the same dimensions as \samp{height}. Other sequences
+ of color will probably not result in an easy to interpret plot.
+
+ \samp{barp} is intended to simplify illustrating categorical data for which both
+ the variable designations and the categories are names, as on many multiple
+ choice questions.  \samp{height.at} and \samp{height.lab} allow the user to place
+ labels on the vertical axis, usually representing the options. If \samp{staxx}
+ or \samp{staxy} are TRUE, the labels on the horizontal or vertical axes
+ respectively will be staggered, allowing the user to use many or lengthy variable
+ or value labels. If \samp{srt} is not NA, these labels will be rotated 
+ counterclockwise by that value as angles in degrees instead of staggered.
+
+ \samp{barp} allows two enhancements that may be useful in those areas where fancy
+ plots are appreciated. One is to give the bars a cylindrical look by shading the
+ color. The other is to place an apparent shadow behind each bar. Both of these
+ effects appear as though the light is coming from the upper left, and this is
+ hard coded. You can add error bars by calling \samp{dispersion}, but many advise
+ against this.
+
+ If \samp{legend.lab} is not NULL, a legend will be displayed. If 
+ \samp{legend.pos} is NA, \samp{locator} is called to place the legend. On 
+ Windows, the alert may not appear on the console, and the function will 
+ appear to hang unless the user clicks on the console window or the plot.
+
+ The \samp{ylog} argument produces a log scale on the y axis. Currently,
+ neither \samp{pretty} nor \samp{axTicks} seems to produce a nice set of axis
+ ticks, so it is best to pass the positions of these in \samp{height.at}.
+
+ If the \samp{pch} argument is not NULL, barp will display white bars filled
+ with the symbols specified in \samp{pch}. With grouped bars, this must be a
+ matrix with the same form as the \samp{col} argument. This option allows a
+ black and white bar plot to be produced.
+}
+\author{Jim Lemon}
+\seealso{\link{staxlab}, \link{barplot}, \link{cylindrect},
+ \link{gradient.rect}}
+\examples{
+ # get some extra room on the left
+ par(mar=c(5,5,4,2))
+ # make up some happiness data, as so many seem to do
+ happyday<-data.frame(Monday=c(2.3,3.4),Tuesday=c(2.8,3.3),Wednesday=c(3.2,3.1),
+ Thursday=c(3.6,2.8),Friday=c(4.2,2.6),Saturday=c(4.5,2.9),Sunday=c(4.1,2.8))
+ happylabels<-c("Utterly dashed","Rather mopey","Indifferent","Somewhat elated",
+  "Euphoric")
+ barp(happyday,names.arg=names(happyday),legend.lab=c("Slaves","Unemployed"),
+  legend.pos=list(x=2,y=4.5),col=c("#ee7700","#3333ff"),main="9AM happiness by weekday",
+  xlab="Day of week",ylab="Happiness rating",ylim=c(1,5),staxx=TRUE,staxy=TRUE,
+  height.at=1:5,height.lab=happylabels,cex.axis=0.9,cylindrical=TRUE,
+  shadow=TRUE)
+ # now do a plot with colors scaled to the sex ratio (real data!)
+ sexratio<-c(0.24,0.35,0.09,0.59,0.63,0.34,0.7,0.6)
+ # the fun ratings are once again a pack of lies
+ funrating<-c(3.2,3.5,1.5,5.4,4.5,2.7,6.8,4.9)
+ funstudy<-c("Astronomy","Chemistry","Economics","Anthropology","Linguistics",
+  "Math/Stats","Psychology","Sociology")
+ funlabels<-c("Torture","Agony","Boredom","Neutral","Entertaining","Exhilarating",
+  "Maniacal")
+ # xrange is used to get the colors to match the 0-100% scale
+ barp(funrating,names.arg=funstudy,main="Fun ratings for various areas of study",
+  col=color.scale(sexratio,c(0.2,1),c(0.2,0.4),c(1,0.4),xrange=c(0,1)),
+  xlab="Study",ylab="Rating",height.at=1:7,height.lab=funlabels,ylim=c(1,7),
+  staxx=TRUE,staxy=TRUE,cex.axis=0.9)
+ # here we want the full scale from zero to one
+ color.legend(2,6,4,6.4,legend=c("100\% guys","100\% girls"),
+  rect.col=color.scale(seq(0,1,by=0.25),c(0.2,1),c(0.2,0.4),c(1,0.4)))
+ par(mar=c(5,4,4,2))
+ # use barp to display a multiple histogram with a shaded background
+ # notice how the expression uses local variables inside the barp function
+ gradbg<-"gradient.rect(xlim[1],ylim[1],xlim[2],ylim[2],
+  c(1,0.5,1),c(1,0.5,1),c(1,0.5,1),gradient=\"y\",nslices=100)"
+ h1<-table(cut(rnorm(100,4),breaks=seq(0,8,by=2)))
+ h2<-table(cut(rnorm(100,4),breaks=seq(0,8,by=2)))
+ h3<-table(cut(rnorm(100,4),breaks=seq(0,8,by=2)))
+ hmat<-matrix(c(h1,h2,h3),nrow=3,byrow=TRUE)
+ barp(hmat,names.arg=names(h1),width=0.45,col=2:4,do.first=gradbg,
+  main="Multiple histogram using barp",xlab="Bins",ylab="Frequency")
+ legend(3.8,50,c("h1","h2","h3"),fill=2:4)
+ # now display a positive/negative plot
+ barp(c(2,-3,4,-5,6,-7,8),main="Positive/negative plot",
+  xlab="Alternating colors",ylab="For alternating values",
+  col=2+(c(2,-3,4,-5,6,-7,8)>0))
+}
+\keyword{misc}
diff --git a/man/battleship.plot.Rd b/man/battleship.plot.Rd
new file mode 100644
index 0000000..610d8b5
--- /dev/null
+++ b/man/battleship.plot.Rd
@@ -0,0 +1,48 @@
+\name{battleship.plot}
+\alias{battleship.plot}
+\title{Display a matrix of values as the widths of stacked rectangles}
+\usage{
+ battleship.plot(x,mar=c(2,5,5,1),col="white",border="black",
+ main="",xlab="",ylab="",xaxlab=NA,yaxlab=NA,cex.labels=1,
+ maxxspan=0.45,maxyspan=0.45)
+}
+\arguments{
+ \item{x}{A matrix or data frame containing numeric values. See the example.}
+ \item{mar}{Margins for the plot.}
+ \item{col}{The fill colors for the rectangles.}
+ \item{border}{The border colors for the rectangles.}
+ \item{main}{The title for the plot (i.e. \samp{main}).}
+ \item{xlab,ylab}{The x and y axis labels.}
+ \item{xaxlab,yaxlab}{Optional labels for the rows and columns.}
+ \item{cex.labels}{Character expansion for the row and column labels.}
+ \item{maxxspan,maxyspan}{Scaling factor for the widths and heights of the
+  rectangles so that they don't overlap.}
+}
+\description{
+ \samp{battleship.plot} displays a matrix of rectangles, with widths
+ proportional to the values in \samp{x}. The values are scaled so that half the
+ width of the largest rectangle is equal to \samp{maxxspan} in user units. This
+ prevents the rectangles from overlapping. The user can adjust the spacing of the
+ stacks of rectangles by changing \samp{maxxspan}. Similarly, maxyspan controls
+ the spacing between rectangles in the vertical direction.
+
+ The labels for each stack of plots (the columns of x) are displayed at the top
+ of the plot, angled at 45 degrees. The labels for each row of rectangles in the
+ stacks (the rows of x) are displayed at the left. Long labels for either may
+ require adjusting the \samp{mar} argument. 
+
+ The function will try to extract the labels \samp{xaxlab} and \samp{yaxlab} from
+ the matrix column and row names respectively if none are passed.
+}
+\value{nil}
+\author{Jim Lemon - thanks to Adam Maltese for the suggestion}
+\keyword{misc}
+\seealso{\link{plot}, \link{staxlab}}
+\examples{
+ x<-matrix(sample(10:50,100,TRUE),10)
+ xaxlab=c("One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten")
+ yaxlab=c("First","Second","Third","Fourth","Fifth","Sixth","Seventh",
+  "Eighth","Ninth","Tenth")
+ battleship.plot(x,xlab="The battle has just begun",main="Battleship1",
+  xaxlab=xaxlab,yaxlab=yaxlab)
+}
diff --git a/man/bin.wind.records.Rd b/man/bin.wind.records.Rd
new file mode 100755
index 0000000..a410651
--- /dev/null
+++ b/man/bin.wind.records.Rd
@@ -0,0 +1,35 @@
+\name{bin.wind.records}
+\alias{bin.wind.records}
+\title{Classify wind direction and speed records}
+\description{Classifies wind direction and speed records into a matrix of
+ percentages of observations in speed and direction bins.}
+\usage{
+ bin.wind.records(winddir,windspeed,ndir=8,radians=FALSE,
+  speed.breaks=c(0,10,20,30))
+}
+\arguments{
+ \item{winddir}{A vector of wind directions.}
+ \item{windspeed}{A vector of wind speeds corresponding to the above
+  directions.}
+ \item{ndir}{Number of direction bins in a compass circle.}
+ \item{radians}{Whether wind directions are in radians.}
+ \item{speed.breaks}{Minimum wind speed for each speed bin.}
+}
+\details{
+ \samp{bin.wind.records} bins a number of wind direction and speed
+  records into a matrix of percentages of observations that can be used to
+  display a cumulative wind rose with \samp{oz.windrose} The defaults are those
+  used by the Australian Bureau of Meteorology.
+}
+\value{
+ A matrix of percentages in which the rows represent wind speed categories and 
+ the columns represent wind direction categories.
+}
+\author{Jim Lemon}
+\seealso{\link{oz.windrose}}
+\examples{
+ winddir<-sample(0:360,100,TRUE)
+ windspeed<-sample(0:40,100,TRUE)
+ bin.wind.records(winddir,windspeed)
+}
+\keyword{misc}
diff --git a/man/binciW.Rd b/man/binciW.Rd
new file mode 100644
index 0000000..e644848
--- /dev/null
+++ b/man/binciW.Rd
@@ -0,0 +1,28 @@
+\name{binciW}
+\alias{binciW}
+\title{Binomial confidence limits}
+\description{
+ Calculates binomial confidence limits using the Wilson approximation.
+}
+\usage{
+ binciW(x,n,alpha=0.05,cc=FALSE)
+}
+\arguments{
+ \item{x}{The number of successes or failures for which the CI is to be calculated.}
+ \item{n}{The number of trials as above.}
+ \item{alpha}{The desired coverage - 0.05 produces 95 percent coverage}
+ \item{cc}{Whether to apply a continuity correction}
+}
+\details{
+ \samp{binciW} calculates binomial confidence limits for the
+ given number of successes and trials. It is mainly to allow binomial
+ confidence limits to be calculated in the \samp{brkdnNest} function,
+ which is why the upper and lower CIs are called separately.
+}
+\value{The lower and upper binomial confidence limits}
+\author{Jim Lemon}
+\seealso{\link{binciWl}, \link{binciWu}}
+\examples{
+ binciW(5,42)
+}
+\keyword{misc}
diff --git a/man/binciWl.Rd b/man/binciWl.Rd
new file mode 100755
index 0000000..ace3235
--- /dev/null
+++ b/man/binciWl.Rd
@@ -0,0 +1,26 @@
+\name{binciWl}
+\alias{binciWl}
+\title{Lower binomial confidence limit}
+\description{
+ Returns the lower binomial confidence limit using the Wilson approximation.
+}
+\usage{
+ binciWl(x,n,alpha=0.05,trueval=TRUE,na.rm=TRUE)
+}
+\arguments{
+ \item{x}{The number of successes or failures for which the CI is to be calculated.}
+ \item{n}{The number of trials as above.}
+ \item{alpha}{The desired coverage - 0.05 produces 95 percent coverage}
+ \item{trueval}{The value representing the outcome of interest for the CI.}
+ \item{na.rm}{Argument needed to make this work}
+}
+\details{
+ \samp{binciWl} now calls \samp{binciW} and returns the lower limit.
+}
+\value{The lower binomial confidence limit}
+\author{Jim Lemon}
+\seealso{\link{binciWu}}
+\examples{
+ binciWl(c(rep(5,TRUE),rep(37,FALSE)))
+}
+\keyword{misc}
diff --git a/man/binciWu.Rd b/man/binciWu.Rd
new file mode 100755
index 0000000..2b20e80
--- /dev/null
+++ b/man/binciWu.Rd
@@ -0,0 +1,26 @@
+\name{binciWu}
+\alias{binciWu}
+\title{Upper binomial confidence limit}
+\description{
+ Returns the upper binomial confidence limit using the Wilson approximation.
+}
+\usage{
+ binciWu(x,n,alpha=0.05,trueval=TRUE,na.rm=TRUE)
+}
+\arguments{
+ \item{x}{The number of successes or failures for which the CI is to be calculated.}
+ \item{n}{The number of trials as above.}
+ \item{alpha}{The desired coverage - 0.05 produces 95 percent coverage}
+ \item{trueval}{The value representing the outcome of interest for the CI.}
+ \item{na.rm}{Argument needed to make this work}
+}
+\details{
+ \samp{binciWu} now calls \samp{binciW} and returns the upper limit.
+}
+\value{The upper binomial confidence interval}
+\author{Jim Lemon}
+\seealso{\link{binciWl}}
+\examples{
+ binciWl(c(rep(5,TRUE),rep(37,FALSE)))
+}
+\keyword{misc}
diff --git a/man/box.heresy.Rd b/man/box.heresy.Rd
new file mode 100644
index 0000000..0ca531e
--- /dev/null
+++ b/man/box.heresy.Rd
@@ -0,0 +1,71 @@
+\name{box.heresy}
+\alias{box.heresy}
+\title{Display a sort of box plot}
+\usage{
+ box.heresy(x,y,uinner,linner=uinner,ulim,llim=ulim,boxwidth=NA,
+  intervals=FALSE,arrow.cap=NA,pch=22,main="",xlab="",ylab="",
+  xaxlab=NA,col="white",do.first=NULL,...)
+}
+\arguments{
+ \item{x,y}{Vectors of numeric values representing measures of central tendency.}
+ \item{uinner,linner}{Vectors of numeric values representing "inner" measures of
+  dispersion.}
+ \item{ulim,llim}{Vectors of numeric values representing "outer" measures of
+  dispersion.}
+ \item{boxwidth}{Optional widths for the boxes.}
+ \item{intervals}{Whether the values for dispersion are intervals (TRUE) or
+  absolute limits (FALSE).}
+ \item{arrow.cap}{The width of the cap on the "whiskers" relative to the width
+  of the plot. Defaults to the same width as the outer box.}
+ \item{pch}{The symbol to be used to represent the measure(s) of central tendency
+  in the box.}
+ \item{main}{The title for the plot (i.e. \samp{main}).}
+ \item{xlab,ylab}{The x and y axis labels.}
+ \item{xaxlab}{Optional labels for the boxes.}
+ \item{col}{The fill colors for the "inner" rectangles.}
+ \item{do.first}{An expression that will be evaluated before anything is displayed.}
+ \item{...}{additional arguments passed to the \samp{dispersion} function.}
+}
+\description{
+ \samp{box.heresy} displays a box plot in which a symbol represents a measure of
+ central tendency, a surrounding box that represents an "inner" measure of dispersion
+ (e.g. standard error) and whiskers represent an "outer" measure of dispersion
+ (e.g. standard deviation). The function is pretty basic at this time and will 
+ probably change a bit.
+
+ One of the first changes is to allow varying box widths. The user can specify
+ the box widths as a vector of numeric values at least as long as the number
+ of boxes to be displayed. The usual reason for doing this is to display widths
+ that are proportional to the number of observations. A useful start is to pass
+ \samp{boxwidth} as the number of observations and let the function work it out.
+}
+\value{nil}
+\author{Jim Lemon - thanks to Gianni Lavaredo for the suggestion}
+\keyword{misc}
+\seealso{\link{plot}, \link{boxplot}}
+\examples{
+ y1<-runif(20,2,10)
+ y2<-rnorm(30,6,2)
+ y3<-sample(0:20,40,TRUE)
+ Ns<-c(20,30,40)
+ ymean<-c(mean(y1),mean(y2),mean(y3))
+ y1inner<-quantile(y1,probs=c(.16,.84))
+ y2inner<-c(ymean[2]+sd(y2),ymean[2]-sd(y2))
+ y3inner<-quantile(y3,probs=c(.16,.84))
+ uinner<-c(y1inner[1],y2inner[1],y3inner[1])
+ linner<-c(y1inner[2],y2inner[2],y3inner[2])
+ ulim<-c(max(y1),max(y2),max(y3))
+ llim<-c(min(y1),min(y2),min(y3))
+ box.heresy(ymean,uinner=uinner,linner=linner,ulim=ulim,llim=llim,boxwidth=Ns,
+  main="Boxplot of means, central spread and range",xlab="Distribution",
+  xaxlab=c("Uniform","Normal","Sample"))
+ y1outer<-
+ y<-runif(5)
+ ulim<-runif(5)
+ llim<-runif(5)
+ uinner<-ulim/2
+ linner<-llim/2
+ box.heresy(y,uinner=uinner,linner=linner,ulim=ulim,llim=llim,
+  intervals=TRUE,main="The heretical boxplot",
+  xlab="Number of observations",ylab="Value")
+}
diff --git a/man/boxed.labels.Rd b/man/boxed.labels.Rd
new file mode 100755
index 0000000..4e49143
--- /dev/null
+++ b/man/boxed.labels.Rd
@@ -0,0 +1,73 @@
+\name{boxed.labels}
+\alias{boxed.labels}
+\title{ Place labels in boxes }
+\description{
+ Places labels in boxes on an existing plot
+}
+\usage{
+ boxed.labels(x,y=NA,labels,
+  bg=ifelse(match(par("bg"),"transparent",0),"white",par("bg")),
+  border=TRUE,xpad=1.2,ypad=1.2,srt=0,cex=1,adj=0.5,xlog=FALSE,ylog=FALSE,...)
+}
+\arguments{
+ \item{x,y}{x and y position of the centers of the labels. \samp{x} can be an
+  \link{xy.coords} list.}
+ \item{bg}{The fill color of the rectangles on which the labels are displayed
+  (see Details).}
+ \item{labels}{Text strings}
+ \item{border}{Whether to draw borders around the rectangles.}
+ \item{xpad,ypad}{The proportion of the rectangles to the
+  extent of the text within.}
+ \item{srt}{Rotation of the labels. If 90 or 270 degrees, the box will be
+  rotated 90 degrees.}
+ \item{cex}{Character expansion. See \samp{text}.}
+ \item{adj}{left/right adjustment. If this is set outside the function,
+  the box will not be aligned properly.}
+ \item{xlog}{Whether the X axis is a log axis}
+ \item{ylog}{Whether the Y axis is a log axis}
+ \item{...}{additional arguments passed to \samp{text}.}
+}
+\details{
+ The label(s) are displayed on a rectangular background. This may be useful
+ for visibility and is the reason that "transparent" background is not available.
+ With the default \samp{textcol=NA}, the function tries to work out whether white
+ or black text will be more easily read based on the background color and displays
+ the text accordingly. If the user specifies text colors in the additional
+ arguments, these colors will override the automatic white/black above - see the
+ last example.
+
+ Only right angle rotations are allowed in \samp{boxed.labels}. \emph{Important
+ change}: \samp{xpad} and \samp{ypad} are now the full proportion of
+ the box to text, not half. The user can now call \samp{cylindrect} or
+ \samp{gradient.rect} for the background rectangle.
+}
+\note{
+ This function is best for regularly spaced labels where overlapping is
+ not a problem. See \link{thigmophobe.labels} for placing labels 
+ where overlap is likely.
+}
+\value{nil}
+\author{Jim Lemon - thanks to Thorn Thaler for the code allowing
+ user-specified text colors and Flemming Skjoth for the log axis correction}
+\seealso{\link{spread.labels}, \link{thigmophobe.labels}}
+\examples{
+ x<-rnorm(10)
+ y<-rnorm(10)
+ plot(x,y,type="p")
+ nums<-c("one","two","three","four","five","six","seven","eight","nine","ten")
+ boxed.labels(x,y-0.1,nums)
+ # now label a barplot
+ xpos<-barp(c(1,3,2,4))
+ boxed.labels(xpos$x,0.5,nums[1:4])
+ # and add labels below the x axis ticks
+ boxed.labels(xpos$x,-0.4,c("First","Second","Third","Fourth"))
+ # perform a PCA on the "swiss" dataset and plot the first two components
+ data(swiss)
+ swiss.pca<-prcomp(swiss)
+ plot(swiss.pca$rotation[,1:2],xlim=c(-1,0.2),main="PCA of swiss dataset",
+  type="n")
+ boxed.labels(swiss.pca$rotation[1:6],swiss.pca$rotation[7:12],ypad=1.5,
+  colnames(swiss),bg=c("red","purple","blue","blue","darkgreen","red"),
+  col="yellow")
+}
+\keyword{misc}
diff --git a/man/brkdn.plot.Rd b/man/brkdn.plot.Rd
new file mode 100755
index 0000000..4976479
--- /dev/null
+++ b/man/brkdn.plot.Rd
@@ -0,0 +1,90 @@
+\name{brkdn.plot}
+\alias{brkdn.plot}
+\title{A point/line plotting routine}
+\description{Display a point/line plot of breakdowns of one or more variables.}
+\usage{
+ brkdn.plot(vars,groups=NA,obs=NA,data,mct="mean",md="std.error",stagger=NA,
+ dispbar=TRUE,main="Breakdown plot",xlab=NA,ylab=NA,xaxlab=NA,
+ ylim=NA,type="b",pch=1,lty=1,col=par("fg"),staxx=FALSE,yat=NA,...)
+}
+\arguments{
+ \item{vars}{The names or indices of one or more columns in a data frame.
+  The columns must contain numeric data. If only one variable is to be
+  broken down, vars can be a formula.}
+ \item{groups}{The name or index of a column in a data frame that classifies
+  the values in \samp{vars} into different, usually fixed effect, levels.}
+ \item{obs}{The name or index of a column in a data frame that classifies
+  the values in \samp{vars} into different, usually random effect, levels.}
+ \item{data}{The data frame.}
+ \item{mct}{The measure of central tendency to calculate for each group.}
+ \item{md}{The measure of dispersion to calculate, NA for none.}
+ \item{stagger}{The amount to offset the successive values at each horizontal
+  position as a proportion of the width of the plot. The calculated default
+  is usually adequate. Pass zero for none.}
+ \item{dispbar}{Whether to display the measures of dispersion as bars.}
+ \item{main}{The title at the top of the plot.}
+ \item{xlab,ylab}{The labels for the X and Y axes respectively. There are
+  defaults, but they are basic.}
+ \item{xaxlab}{Optional labels for the horizontal axis ticks.}
+ \item{ylim}{Optional vertical limits for the plot.}
+ \item{type}{Whether to plot symbols, lines or both (as in \samp{plot}).}
+ \item{pch}{Symbol(s) to plot.}
+ \item{lty}{Line type(s) to plot.}
+ \item{col}{Color(s) for the symbols and lines.}
+ \item{staxx}{Whether to call \link{staxlab} to display the X axis
+  labels.}
+ \item{yat}{Optional y axis tick positions.}
+ \item{...}{additional arguments passed to \samp{plot}.}
+}
+\value{
+ A list of two matrices of dimension \samp{length(levels(groups))} by 
+ \samp{length(levels(obs))}. The first contains the measures of central
+ tendency calculated and its name is the name of the function passed as
+ \samp{mct}. The second contains the measures of dispersion and its name
+ is the name of the function passed as \samp{md}.
+ 
+ If both \samp{groups} and \samp{obs} are not NA, the rows of each matrix
+ will be the \samp{groups} and the columns the \samp{obs}. If \samp{obs}
+ is NA, the rows will be the \samp{groups} and the columns the \samp{vars}.
+ If \samp{groups} is NA, the rows will be the \samp{vars} and the columns
+ the \samp{obs}. That is, if \samp{vars} has more than one element, if
+ \samp{obs} is NA, the elements of \samp{vars} will be considered to
+ represent observations, while if \samp{groups} is NA, they will be
+ considered to represent groups. At least one of \samp{groups} and \samp{obs}
+ must be not NA or there is no point in using \samp{brkdn.plot}.
+}
+\details{
+ \samp{brkdn.plot} displays a plot useful for visualizing the breakdown of a
+ response measure by two factors, or more than one response measure by either
+ a factor representing something like levels of treatment (\samp{groups}) or
+ something like repeated observations (\samp{obs}). For example, if
+ observations are made at different times on data objects that receive
+ different treatments, the \samp{groups} factor will display the measures
+ of central tendency as points/lines with the same color, symbol and line type,
+ while the \samp{obs} factor will be represented as horizontal positions on the
+ plot. If \samp{obs} is numeric, its unique values will be used as the 
+ positions, if not, 1 to the number of unique values. This is a common way of 
+ representing changes over time intervals for experimental groups.
+
+ If only one numeric variable is to be broken down, \samp{vars} may be a
+ formula like \samp{var~groups+obs}. The position of the two factors to break
+ down the variable is fixed - the second term will be interpreted as "groups"
+ and the third, if present, will be interpreted as "obs".
+}
+\author{Jim Lemon}
+\seealso{\link{dispersion}}
+\examples{
+ test.df<-data.frame(a=rnorm(80)+4,b=rnorm(80)+4,c=rep(LETTERS[1:4],each=20),
+  d=rep(rep(letters[1:4],each=4),5))
+ # first use the default values
+ brkdn.plot("a","c","d",test.df,pch=1:4,col=1:4)
+ # now jazz it up a bit using medians and median absolute deviations
+ # and some enhancements
+ bp<-brkdn.plot(a~c+d,data=test.df,main="Test of the breakdown plot",
+  mct="median",md="mad",xlab="Temperature range", ylab="Cognition",
+  xaxlab=c("10-15","16-20","21-25","25-30"),pch=1:4,lty=1:4,col=1:4)
+ es<-emptyspace(bp)
+ legend(es,legend=c("Sydney","Gosford","Karuah","Brisbane"),pch=1:4,
+  col=1:4,lty=1:4,xjust=0.5,yjust=0.5)
+}
+\keyword{misc}
diff --git a/man/brkdnNest.Rd b/man/brkdnNest.Rd
new file mode 100755
index 0000000..da4cd1a
--- /dev/null
+++ b/man/brkdnNest.Rd
@@ -0,0 +1,67 @@
+\name{brkdnNest}
+\alias{brkdnNest}
+\title{Perform a nested breakdown of numeric values}
+\description{Breaks down a numeric or categorical element of a data frame
+ by one or more categorical elements.}
+\usage{
+ brkdnNest(formula,data,FUN=c("mean","sd","sd","valid.n"),label1="Overall",
+  trueval=TRUE)
+}
+\arguments{
+ \item{formula}{A formula with a numeric element of a data frame on the left and
+  one or more categorical elements on the right.}
+ \item{data}{A data frame containing the elements in \samp{formula}.}
+ \item{FUN}{The functions to be applied to successive breakdowns.}
+ \item{label1}{The label to use for the overall value of the first function.}
+ \item{trueval}{The value to use in calculating proportions or sums of a
+  categorical response variable. See Details.}
+}
+\value{
+ A list with as many elements as there are functions in \samp{FUN}. It is
+ probably best to always specify four functions (summary measure, upper
+ dispersion measure, lower dispersion measure and number of valid observations)
+ even if this is redundant as in the default.
+
+ This function is similar to \samp{brkdn} in the \pkg{prettyR} package, but
+ is structured to be used with the \samp{barNest} function. It produces one
+ or more measures for the overall data, then the subsets of the data defined by
+ the first variable to the right of the tilde, then the subsets defined by
+ the first and second variable, and so on.
+}
+\details{
+ \samp{brkdnNest} performs a nested breakdown of an element of a data frame
+ by one or more categorical elements. For each category and optional
+ subcategories, the variable on the left of the formula is summarized as
+ specified by the functions named in \samp{FUN}.
+
+ If \samp{trueval} is not NA, brkdnNest will calculate the proportion of
+ \samp{trueval} values in the response variable out of the total valid
+ responses. If the function \samp{valid.n} is the first function in 
+ \samp{FUN}, the counts of the groups and subgroups will be returned.
+
+ Two specialized summary functions are defined within \samp{brkdnNest}.
+ \samp{sumbrk} returns the count of values in a factor equal to \samp{trueval},
+ and \samp{propbrk} returns the proportion of values equal to 
+ \samp{trueval}. Be aware that if a categorical variable is specified on 
+ the left of the formula, functions which expect numeric data such as 
+ \samp{mean} should not be included in \samp{FUN}.
+
+ The user should take care when specifying different summary functions.
+ \samp{barNest} expects a summary measure as the first component of the list
+ and measures of dispersion as the second and third. If two different measures
+ of dispersion are passed, the first must calculate the upper and the second
+ the lower measure.
+}
+\author{Jim Lemon}
+\seealso{\link{by}}
+\examples{
+ brkdntest<-data.frame(Age=rnorm(100,25,10),
+  Sex=sample(c("M","F"),100,TRUE),
+  Marital=sample(c("M","X","S","W"),100,TRUE),
+  Employ=sample(c("FT","PT","NO"),100,TRUE))
+ brkdnNest(formula=Age~Sex+Marital+Employ,data=brkdntest)
+ # show the proportion of unemployed with binomial confidence intervals
+ brkdnNest(formula=Employ~Sex+Marital,data=brkdntest,
+  FUN=c("propbrk","binciWu","binciWl"),trueval="NO")
+}
+\keyword{misc}
diff --git a/man/bumpchart.Rd b/man/bumpchart.Rd
new file mode 100755
index 0000000..a407cc0
--- /dev/null
+++ b/man/bumpchart.Rd
@@ -0,0 +1,68 @@
+\name{bumpchart}
+\alias{bumpchart}
+\title{Display a "bumps" chart}
+\description{
+ Display a chart with two of more columns of points in order of ascending values
+ with lines connecting the points in a row.
+}
+\usage{
+ bumpchart(y,top.labels=colnames(y),labels=rownames(y),rank=TRUE,
+  mar=c(2,8,5,8),pch=19,col=par("fg"),lty=1,lwd=1,arrows=FALSE,...)
+}
+\arguments{
+ \item{y}{A numeric matrix or data frame which may contain NAs.}
+ \item{top.labels}{The strings that will appear at the top of each column of
+  points on the plot.}
+ \item{labels}{The strings that will appear next to the outer columns of
+  points.}
+ \item{rank}{Whether to rank the values in \samp{y} before plotting.}
+ \item{mar}{The margins to use for the bumps chart. Alter to your taste.}
+ \item{pch}{The symbols to use when plotting the points.}
+ \item{col}{The colors to use.}
+ \item{lty}{The line types to use.}
+ \item{lwd}{The line widths to use.}
+ \item{arrows}{Whether to join the points with lines (FALSE) or arrows (TRUE).}
+ \item{...}{Additional arguments passed to \samp{matplot} or \samp{arrows}.}
+}
+\details{
+ \samp{bumpchart} calls \samp{matplot} to plot the values in the transposed
+ \samp{y} matrix or data frame, joining the points with lines. At the left and
+ right edges of the plot, the labels identifying each row of points are
+ displayed. This type of plot is often used to show the changing positions of
+ entities over time, like the ranking in surveys in different years. For a
+ similar, but more flexible plot, see \link{ladderplot}.
+
+ Because of the way \samp{matplot} plots the values, the order of everything is
+ reversed. As the typical display of ranks is with rank 1 at the top, the
+ actual rank positions are used to plot the values.
+ This places the lowest scores at the bottom of the plot and the highest at
+ the top.
+
+ Any arguments that are included in \samp{...} will be passed to \samp{matplot}
+ if the \samp{arrows} argument is FALSE, and to the \samp{arrows} function if
+ the \samp{arrows} argument is TRUE as in the first example.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{matplot}}
+\examples{
+ # percentage of those over 25 years having completed high school
+ # in 10 cities in the USA in 1990 and 2000
+ educattn<-matrix(c(90.4,90.3,75.7,78.9,66,71.8,70.5,70.4,68.4,67.9,
+  67.2,76.1,68.1,74.7,68.5,72.4,64.3,71.2,73.1,77.8),ncol=2,byrow=TRUE)
+ rownames(educattn)<-c("Anchorage AK","Boston MA","Chicago IL",
+  "Houston TX","Los Angeles CA","Louisville KY","New Orleans LA",
+  "New York NY","Philadelphia PA","Washington DC")
+ colnames(educattn)<-c(1990,2000)
+ bumpchart(educattn,main="Rank for high school completion by over 25s",
+  arrows=TRUE,length=0.2)
+ # now show the raw percentages and add central ticks
+ bumpchart(educattn,rank=FALSE,
+  main="Percentage high school completion by over 25s",
+  lty=1:10,lwd=1,col=rainbow(10))
+ # margins have been reset, so use
+ par(xpd=TRUE)
+ boxed.labels(1.5,seq(65,90,by=5),seq(65,90,by=5))
+ par(xpd=FALSE)
+}
+\keyword{misc}
diff --git a/man/categoryReshape.Rd b/man/categoryReshape.Rd
new file mode 100644
index 0000000..c6f8205
--- /dev/null
+++ b/man/categoryReshape.Rd
@@ -0,0 +1,31 @@
+\name{categoryReshape}
+\alias{categoryReshape}
+\title{Convert object label/attribute label coding.}
+\description{Convert object label/attribute label coding to an object by
+ attribute data frame.}
+\usage{
+ categoryReshape(x)
+}
+\arguments{
+ \item{x}{A matrix or data frame with at least two columns.}
+}
+\details{
+ \samp{categoryReshape} attempts to convert the first two columns of its input
+ into a data frame in which rows represent objects and columns attributes. For
+ each object, a value of 1 indicates that the object has that attribute, and a
+ value of 0 that it does not. In set membership terms, a 1 indicates that the
+ object is a member of that set and a 0 that it is not.
+}
+\value{A data frame (see Details).}
+\keyword{misc}
+\author{Jim Lemon}
+\seealso{\link{makeIntersectList}}
+\examples{
+ ns<-sample(1:8,20,TRUE)
+ objects<-0
+ for(i in 1:length(ns)) objects<-c(objects,rep(i,ns[i]))
+ attributes<-"Z"
+ for(i in 1:length(ns)) attributes<-c(attributes,sample(LETTERS[1:8],ns[i]))
+ setdf<-data.frame(objects[-1],attributes[-1])
+ categoryReshape(setdf)
+}
diff --git a/man/centipede.plot.Rd b/man/centipede.plot.Rd
new file mode 100755
index 0000000..602f345
--- /dev/null
+++ b/man/centipede.plot.Rd
@@ -0,0 +1,85 @@
+\name{centipede.plot}
+\alias{centipede.plot}
+\title{Display a centipede plot}
+\description{
+ Displays a centipede plot on the current graphics device.
+}
+\usage{
+ centipede.plot(segs,mct="mean",lower.limit="std.error",
+  upper.limit=lower.limit,left.labels=NULL,right.labels=NULL,sort.segs=TRUE,
+  main="",xlab=NA,pch=21,vgrid=NA,hgrid=NA,gridcol="lightgray",mar=NA,col=par("fg"),
+  bg="green",...)
+}
+\arguments{
+  \item{segs}{a matrix of midpoints and limits calculated by
+   \link{get.segs} OR a \samp{dstat} object returned by
+   \samp{brkdn}.}
+  \item{mct}{The function to use in calculating the midpoint of each
+   segment.}
+  \item{lower.limit}{The functions to use in calculating the
+   lower limits for each subset of the data.}
+  \item{upper.limit}{The functions to use in calculating the
+   upper limits.}
+  \item{left.labels}{The variable or subset labels to place at the left margin of
+   the plot. Default values are provided.}
+  \item{right.labels}{The variable or subset labels to place at the right margin
+   of the plot.}
+  \item{sort.segs}{Whether to sort the segments in ascending order.}
+  \item{main}{Optional title for the plot.}
+  \item{xlab}{Optional x axis label for the plot. The default NA
+   displays a text label showing the midpoint and limit functions.}
+  \item{pch}{The symbols to use when plotting midpoints.}
+  \item{vgrid}{Optional vertical line(s) to display on the plot. Defaults to
+   NA (none).}
+  \item{hgrid}{Optional horizontal grid lines to display on the plot. Defaults
+   to NA (none).}
+  \item{gridcol}{The color for the vgrid and hgrid lines.}
+  \item{mar}{Margin widths for the plot. Defaults to c(4,5,1,4) or 
+   c(4,5,3,4) if there is a title.}
+  \item{col}{The color(s) of the limit lines and borders of the midpoint
+   markers.}
+  \item{bg}{The color(s) to fill the midpoint markers.}
+  \item{...}{additional arguments passed to \samp{plot}.}
+}
+\details{
+ \samp{centipede.plot} displays one or more midpoints and limits as 
+  filled circles with horizontal error bars. It places labels on the left and
+  right sides of the plot. If these labels are long, it may be necessary to
+  pass explicit values to the \samp{mar} argument to leave enough room.
+
+  The \samp{vgrid} argument is usually used to display an average value for
+  all of the midpoints. If one or more values are passed in this argument,
+  they will be displayed as vertical lines spanning the plot. The \samp{hgrid}
+  argument acts like the \samp{grid} function, drawing dashed horizontal lines
+  across the plot. If \samp{hgrid=NULL}, these lines will be drawn under the
+  values displayed, which will be 1 to the number of values on the vertical axis.
+  The user can pass explicit values if desired. With horizontal and optionally
+  vertical grid lines, the centipede plot is practically equivalent to a dotplot
+  with error bars.
+  
+  Similarly, centipede plots typically have a large number of subsets, and 
+  it may be necessary to start the graphics device with an aspect ratio that
+  will prevent crowding of the labels when over 30 segments are displayed.
+  
+  The matrix \samp{segs} may be entered manually or read from a file.
+  The first row specifies midpoints, the second and third rows the lower
+  and upper limits respectively and the fourth row the number of valid
+  observations. If there are no values for number of valid observations,
+  just pass vector of blank strings with the \samp{right.labels} argument.
+  If a \samp{dstat} object is passed as \samp{segs}, the function will calculate
+  the lower and upper values according to the relevant arguments. This type of
+  plot is also known as a caterpillar plot or a league table. 
+}
+\value{nil.}
+\author{Jim Lemon}
+\seealso{\link{get.segs}}
+\examples{
+ testcp<-list("",40)
+ for(i in 1:40) testcp[[i]]<-rnorm(sample(1:8,1)*50)
+ segs<-get.segs(testcp)
+ centipede.plot(segs,main="Test centipede plot",vgrid=0)
+ # now leave out the number of valid observations, pass x labels and no right labels
+ centipede.plot(segs[1:3,],main="Test centipede plot",vgrid=0,mar=c(4,5,3,2),
+  left.labels=paste("X",1:40,sep=""),right.labels=rep("",40))
+}
+\keyword{misc}
diff --git a/man/clean.args.Rd b/man/clean.args.Rd
new file mode 100755
index 0000000..fefbafe
--- /dev/null
+++ b/man/clean.args.Rd
@@ -0,0 +1,35 @@
+\name{clean.args}
+\alias{clean.args}
+\alias{remove.args}
+\title{Remove inappropriate arguments from an argument list}
+\description{
+ Takes a list of arguments and eliminates those that are not
+  appropriate for passing to a particular function (and hence
+  would produce an error if passed).
+}
+\usage{
+ clean.args(argstr,fn,exclude.repeats=FALSE,exclude.other=NULL,dots.ok=TRUE)
+ remove.args(argstr,fn)
+}
+\arguments{
+ \item{argstr}{a named list of arguments, e.g. from \samp{\dots}}
+ \item{fn}{a function}
+ \item{exclude.repeats}{(logical) remove repeated arguments?}
+ \item{exclude.other}{a character vector of names of additional arguments to remove}
+ \item{dots.ok}{should "..." be allowed in the argument list?}
+}
+\value{
+ \samp{clean.args} returns a list which is a copy of \samp{argstr} with
+ arguments inappropriate for \samp{fn} removed; \samp{remove.args}
+ removes the arguments for \samp{fn} from the list.
+}
+\author{Ben Bolker}
+\examples{
+ tststr <- list(n=2,mean=0,sd=1,foo=4,bar=6) 
+ clean.args(tststr,rnorm)
+ try(do.call("rnorm",tststr))
+ do.call("rnorm",clean.args(tststr,rnorm))
+ remove.args(tststr,rnorm)
+ ## add example of combining arg. lists?
+}
+\keyword{programming}
diff --git a/man/clock24.plot.Rd b/man/clock24.plot.Rd
new file mode 100755
index 0000000..3b1f7f3
--- /dev/null
+++ b/man/clock24.plot.Rd
@@ -0,0 +1,47 @@
+\name{clock24.plot}
+\title{Plot values on a 24 hour "clockface"}
+\usage{
+ clock24.plot(lengths,clock.pos,labels=0:23,minutes=FALSE,
+  label.pos=NULL,rp.type="r",...)
+}
+\alias{clock24.plot}
+\arguments{
+ \item{lengths}{numeric data vector. Magnitudes will be represented as
+  line lengths, or symbol or polygon vertex positions.}
+ \item{clock.pos}{numeric vector of positions on the 'clockface'.
+  These must be in decimal hours and will be rescaled to radians.}
+ \item{labels}{Labels to place at the circumference.}
+ \item{minutes}{Whether to add minutes (".00") to the labels.}
+ \item{label.pos}{Radial positions of the labels.}
+ \item{rp.type}{Whether to plot radial lines, symbols or a polygon.}
+ \item{...}{additional arguments are passed to \samp{radial.plot} and
+  then to \samp{plot}.}
+}
+\description{
+ \samp{clock24.plot} displays a plot of radial lines, symbols or a polygon
+  centered at the midpoint of the plot frame on a 24 hour 'clockface'. 
+  In contrast to the default behavior of \samp{radial.plot}, the positions 
+  are interpreted as beginning at vertical (000) and moving clockwise.
+
+ If \samp{add=TRUE} is passed as one of the additional arguments, the values
+ will be added to the current plot. If a \samp{radial.lim} argument was
+ passed on the initial plot, it must be passed again to add values or the
+ values will be displayed incorrectly.
+}
+\value{A list of the parameters altered by \link{radial.plot}.}
+\keyword{misc}
+\author{Jim Lemon}
+\seealso{\link{polar.plot},\link{radial.plot}}
+\examples{
+ testlen<-rnorm(24)*2+5
+ testpos<-0:23+rnorm(24)/4
+ clock24.plot(testlen,testpos,main="Test Clock24 (lines)",show.grid=FALSE,
+  line.col="green",lwd=3)
+ if(dev.interactive()) par(ask=TRUE)
+ # now do a 'daylight' plot
+ oldpar<-clock24.plot(testlen[7:19],testpos[7:19],
+  main="Test Clock24 daytime (symbols)",
+  point.col="blue",rp.type="s",lwd=3)
+ # reset everything
+ par(oldpar)
+}
diff --git a/man/clplot.Rd b/man/clplot.Rd
new file mode 100755
index 0000000..49d756f
--- /dev/null
+++ b/man/clplot.Rd
@@ -0,0 +1,34 @@
+\name{clplot}
+\title{Plot lines with colors determined by values.}
+\usage{
+ clplot(x,y,ylab=deparse(substitute(y)),xlab=deparse(substitute(x)),
+  levels=seq(min(y)+(max(y)-min(y))/5,max(y)-(max(y)-min(y))/5,length.out=4),
+  cols=c("black","blue","green","orange","red"),lty=1,showcuts=FALSE,...)
+}
+\alias{clplot}
+\arguments{
+ \item{x,y}{numeric data vectors.}
+ \item{ylab,xlab}{Labels for the X and Y axes.}
+ \item{levels}{Cut points to assign colors to the values of \samp{x} and
+  \samp{y}.}
+ \item{cols}{The colors to be assigned.}
+ \item{lty}{The line type.}
+ \item{showcuts}{Whether to show the positions of the cut points.}
+ \item{...}{additional arguments passed to \samp{plot} or \samp{lines}.}
+}
+\description{
+ \samp{clplot} displays a plot of lines for which the colors are dependent
+ upon the x and y values. \samp{clplot} is similar to \samp{color.scale.lines}
+ except that while the latter calculates a color for each unique value,
+ \samp{clplot} assigns colors to groups of values within the cutpoints defined
+ by \samp{levels}.
+}
+\value{nil}
+\author{Carl Witthoft}
+\seealso{\link{plot}}
+\examples{
+ x<-seq(1,100)
+ y<-sin(x/5)+x/20
+ clplot(x,y,main="Test of clplot")
+}
+\keyword{misc}
diff --git a/man/cluster.overplot.Rd b/man/cluster.overplot.Rd
new file mode 100755
index 0000000..a757512
--- /dev/null
+++ b/man/cluster.overplot.Rd
@@ -0,0 +1,44 @@
+\name{cluster.overplot}
+\alias{cluster.overplot}
+\title{Shift overlying points into clusters}
+\usage{
+ cluster.overplot(x,y,away=NULL,tol=NULL,...)
+}
+\arguments{
+ \item{x,y}{Numeric data vectors or the first two columns of a matrix
+  or data frame. Typically the x/y coordinates of points to be plotted.}
+ \item{away}{How far to move overlying points in user units. Defaults to
+  the width of a lower case "o" in the x direction and 5/8 of the
+  height of a lower case "o" in the y direction. Must have both values.}
+ \item{tol}{The largest distance between points that will be considered
+  to be overlying. Defaults to 1/2 of the width of a lower case "o" in 
+  the x direction and 1/2 of the height of a lower case "o" in the y 
+  direction.}
+ \item{...}{additional arguments returned as they are passed.}
+}
+\description{
+ \samp{cluster.overplot} checks for overlying points in the x and y
+  coordinates passed. Those points that are overlying are moved to form
+  a small cluster of up to nine points. For large numbers of overlying
+  points, see \link{count.overplot} or \link{sizeplot}.
+  If you are unsure of the number of overplots in your data, run
+  \samp{count.overplot} first to see if there are any potential clusters
+  larger than nine.
+}
+\value{
+ A list with two components. For unique x-y pairs the elements will be 
+ the same as in the original. For overlying points up to eight additional 
+ points will be generated that will create a cluster of points instead of one.
+}
+\keyword{misc}
+\author{Jim Lemon - thanks to Markus Elze for the test for a current graphics
+ device}
+\seealso{\link{count.overplot},\link{sizeplot}}
+\examples{
+ xy.mat<-cbind(sample(1:10,200,TRUE),sample(1:10,200,TRUE))
+ clusteredpoints<-
+  cluster.overplot(xy.mat,col=rep(c("red","green"),each=100),
+  away=rep(0.2,2))
+ plot(clusteredpoints,col=clusteredpoints$col,
+  main="Cluster overplot test")
+}
diff --git a/man/color.axis.Rd b/man/color.axis.Rd
new file mode 100644
index 0000000..5c5218b
--- /dev/null
+++ b/man/color.axis.Rd
@@ -0,0 +1,23 @@
+\name{color.axis}
+\alias{color.axis}
+\title{Display an axis in a specified color}
+\usage{
+ color.axis(side=1,at=NULL,labels=TRUE,axlab=NA,axlab.at=NA,
+  col=par("fg"),cex.axis=par("cex.axis"),cex=par("cex"))
+}
+\arguments{
+ \item{side}{Which axis - see axis.}
+ \item{at}{Positions for the tick labels.}
+ \item{labels}{Tick labels.}
+ \item{axlab}{Optional axis label.}
+ \item{axlab.at}{Where to position the axis label - defaults to centered.}
+ \item{col}{Color for the axis.}
+ \item{cex.axis}{Character expansion for the tick labels.}
+ \item{cex}{Character expansion for the axis label.}
+}
+\description{
+ \samp{color.axis} displays an axis in the specified color.
+}
+\value{nil}
+\author{Jim Lemon}
+\keyword{misc}
diff --git a/man/color.gradient.Rd b/man/color.gradient.Rd
new file mode 100755
index 0000000..c0355da
--- /dev/null
+++ b/man/color.gradient.Rd
@@ -0,0 +1,31 @@
+\name{color.gradient}
+\title{Calculate an arbitrary sequence of colors}
+\usage{
+ color.gradient(reds,greens,blues,nslices=50)
+}
+\alias{color.gradient}
+\arguments{
+ \item{reds,greens,blues}{vectors of the values of the color components
+  as 0 to 1.}
+ \item{nslices}{The number of color "slices".}
+}
+\description{
+ \samp{color.gradient} is now just a call to \samp{color.scale} with a
+  vector of equally spaced integers (1:nslices). The function is kept for
+  backward compatibility.
+}
+\note{
+ The function is mainly useful for defining a set of colors to represent
+ a known number of gradations. Such a set can be used to assign a grade
+ to a small number of values (e.g. points on a scatterplot - but see 
+ \samp{color.scale} for large numbers) and display a color bar using
+ \samp{gradient.rect} as a legend.
+}
+\value{A vector of hexadecimal color values as used by \samp{col}.}
+\author{Jim Lemon}
+\seealso{\link{rescale},\link{approx},\link{color.scale}}
+\examples{
+ # try it with red and blue endpoints and green midpoints.
+ color.gradient(c(0,1),c(1,0.6,0.4,0.3,0),c(0.1,0.6))
+}
+\keyword{misc}
diff --git a/man/color.id.Rd b/man/color.id.Rd
new file mode 100755
index 0000000..f3df361
--- /dev/null
+++ b/man/color.id.Rd
@@ -0,0 +1,25 @@
+\name{color.id}
+\alias{color.id}
+\title{Identify closest match to a color}
+\description{
+ Given a color specified as a hex string, find the closest match in the
+ table of known (named) colors
+}
+\usage{
+ color.id(col)
+}
+\arguments{
+ \item{col}{a color specified as a hex string}
+}
+\details{
+ finds the color with the minimum squared distance in RGB space
+}
+\value{
+ the name of the closest match
+}
+\author{Ben Bolker}
+\seealso{\link{col2rgb},\link{colors}}
+\examples{
+ color.id("#cc00cc")
+}
+\keyword{color}
diff --git a/man/color.legend.Rd b/man/color.legend.Rd
new file mode 100755
index 0000000..6804f8e
--- /dev/null
+++ b/man/color.legend.Rd
@@ -0,0 +1,62 @@
+\name{color.legend}
+\alias{color.legend}
+\title{Legend matching categories or values to colors}
+\description{Display a color legend on a plot}
+\usage{
+ color.legend(xl,yb,xr,yt,legend,rect.col,cex=1,align="lt",gradient="x",...)
+}
+\arguments{
+ \item{xl,yb,xr,yt}{The lower left and upper right coordinates of the
+  rectange of colors in user coordinates.}
+ \item{legend}{The labels that will appear next to some or all of the colors.}
+ \item{rect.col}{The colors that will fill the rectangle.}
+ \item{cex}{Character expansion factor for the labels.}
+ \item{align}{How to align the labels relative to the color rectangle.}
+ \item{gradient}{Whether to have a horizontal (x) or vertical (y) color
+  gradient.}
+ \item{...}{Additional arguments passed to \samp{text}.}
+}
+\value{nil}
+\details{
+ \samp{color.legend} displays a rectangle defined by the first four arguments
+ filled with smaller rectangles of color defined by the \samp{rect.col} argument.
+ Labels, defined by the \samp{legend} argument, are placed next to the color
+ rectangle. The position of the labels is determined by whether the color
+ rectangle is horizontal or vertical and the \samp{align} argument. The default
+ value of \samp{lt} places the labels at the left of a vertical rectangle or the
+ top of a horizontal one. \samp{rb} puts them on the other side. To have the
+ labels in the same color as the rectangles, include a \samp{col} argument that
+ will be passed to \samp{text} as in the example.
+
+ There can be fewer labels than colors. The labels will be evenly spaced along
+ the rectangle in this case. It is possible to use empty labels to get uneven
+ spacing. The user can pass more labels than colors, but the labels will almost
+ certainly be crowded and I have only found one use for this. If the user wants
+ the labels at the intersection of the boxes rather than in the center, see the
+ alternative specification for the labels in the example (thanks Claudia Tebaldi).
+ To have complete control over the labels, see \link{gradient.rect} and 
+ \link{text} or \link{mtext}.
+
+ \samp{colorlegend} in the \pkg{shape} package offers a different approach,
+ creating a large number of colors from a color generating function (a bit
+ like \samp{color.gradient}) and then allowing the user to specify tick
+ marks at arbitrary points along the color bar.
+}
+\author{Jim Lemon}
+\seealso{\link{color.gradient}, \link{gradient.rect}}
+\examples{
+ # get some extra room
+ par(mar=c(7,4,4,6))
+ testcol<-color.gradient(c(0,1),0,c(1,0),nslices=5)
+ col.labels<-c("Cold","Warm","Hot")
+ # this will put the labels at the intersections
+ # col.labels<-c("","Cold","","Warm","","Warmer","","Hot","")
+ color2D.matplot(matrix(rnorm(100),nrow=10),c(1,0),0,c(0,1),
+  main="Test color legends")
+ color.legend(11,6,11.8,9,col.labels,testcol,gradient="y")
+ color.legend(10.2,2,11,5,col.labels,testcol,align="rb",gradient="y")
+ color.legend(0.5,-2,3.5,-1.2,col.labels,testcol)
+ color.legend(7,-1.8,10,-1,col.labels,testcol,align="rb",col=testcol[c(1,3,5)])
+ par(mar=c(5,4,4,2))
+}
+\keyword{misc}
diff --git a/man/color.scale.Rd b/man/color.scale.Rd
new file mode 100755
index 0000000..d5c365c
--- /dev/null
+++ b/man/color.scale.Rd
@@ -0,0 +1,85 @@
+\name{color.scale}
+\alias{color.scale}
+\title{Turn values into colors.}
+\description{Transform numeric values into colors using RGB, HSV or HCL}
+\usage{
+ color.scale(x,cs1=c(0,1),cs2=c(0,1),cs3=c(0,1),alpha=1,
+  extremes=NA,na.color=NA,xrange=NULL,color.spec="rgb")
+}
+\arguments{
+ \item{x}{a numeric vector, matrix or data frame}
+ \item{cs1,cs2,cs3}{color parameters for scaling \samp{x}}
+ \item{alpha}{Value for transparency in colors.}
+ \item{extremes}{The colors for the extreme values of \samp{x} (RGB only).}
+ \item{na.color}{The color to use for NA values of \samp{x}.}
+ \item{xrange}{An explicit range to use in the transformation.}
+ \item{color.spec}{The color specification to use in the transformation.
+  Anything other than "rgb", "hsv" or "hcl" will almost certainly fail.}
+}
+\details{
+ \samp{color.scale} calculates a sequence of colors by a linear
+  transformation of the numeric values supplied into the ranges 
+  for the three color parameters. If only one number is supplied for a
+  color range, that color remains constant for all values of \samp{x}.
+  If more than two values are supplied, the \samp{x} values will be
+  split into equal ranges (one less than the number of colors) and 
+  the transformation carried out on each range. Values for a color
+  range must be between 0 and 1 for the RGB or HSV specifications, and 
+  between 0 and 360 (cs1) and 0 to 100 (cs2 and cs3) for the HCL 
+  specifications.
+
+  IMPORTANT: If \samp{x} has fewer values than the number of values
+  in the color parameters, it will usually return incorrect
+  colors. This is usually only a problem when using \samp{color.legend}
+  with a small number of rectangles in the legend as \samp{color.legend}
+  calls \samp{color.scale} to calculate the color rectangles.
+  
+  If \samp{extremes} is not NA, the ranges will be calculated from
+  its values using \samp{col2rgb}, even if ranges are also supplied.
+  \samp{extremes} allows the user to just pass the extreme color values
+  in any format that \samp{col2rgb} will accept. Note that this forces
+  the color specification to RGB.
+
+  If the user wants to specify a range of values with \samp{xrange},
+  it must at least include the range of x values. This can be useful
+  when there is a notional range like 0-100\% that the values do not
+  cover, or when several series of values with different ranges are
+  to be assigned the same color scale.
+
+  The user may not want the color scheme to be continuous across some
+  critical point, often zero. In this case, color scale can be called
+  separately for the values below and above zero. I may get around to
+  adding an argument to do this in one shot. Until then, see the second
+  example for \samp{color2D.matplot} and also the \samp{diverge.hcl} and
+  \samp{diverge.hsv} functions in the \pkg{colorspace} package.
+}
+\note{
+ The function is useful for highlighting a numeric dimension or adding
+ an extra "dimension" to a plot.
+
+ There are quite a few R functions that transform numeric values into
+ colors or produce colors that can be used to represent values. Two
+ packages that might be of interest are \pkg{RColorBrewer} and 
+ \pkg{colourschemes}.
+}
+\value{A vector or matrix of hexadecimal color values.}
+\author{Jim Lemon}
+\seealso{\link{rescale}, \link{col2rgb}, \link{smoothColors}}
+\examples{
+ # go from green through yellow to red with no blue
+ x<-rnorm(20)
+ y<-rnorm(20)
+ # use y for the color scale
+ plot(x,y,col=color.scale(y,c(0,1,1),c(1,1,0),0),main="Color scale plot",
+  pch=16,cex=2)
+ plot(1:10,rep(1:3,length.out=10),axes=FALSE,type="n",xlim=c(0,11),ylim=c(0,4),
+  main="Test of RGB, HSV and HCL",xlab="",ylab="Color specification")
+ axis(2,at=1:3,labels=c("HCL","HSV","RGB"))
+ points(1:10,rep(1,10),pch=19,cex=8,col=color.scale(1:10,c(0,300),35,85,
+  color.spec="hcl"))
+ points(1:10,rep(2,10),pch=19,cex=8,col=color.scale(1:10,c(0,1),
+  0.8,1,color.spec="hsv"))
+ points(1:10,rep(3,10),pch=19,cex=8,col=color.scale(1:10,c(1,0.5,0),
+  c(0,0.5,0),c(0,0,1),color.spec="rgb"))
+}
+\keyword{misc}
diff --git a/man/color.scale.lines.Rd b/man/color.scale.lines.Rd
new file mode 100755
index 0000000..69720c5
--- /dev/null
+++ b/man/color.scale.lines.Rd
@@ -0,0 +1,54 @@
+\name{color.scale.lines}
+\alias{color.scale.lines}
+\title{Line segments with scaled colors}
+\description{Display line segments with colors scaled to numeric values.}
+\usage{
+ color.scale.lines(x,y,reds,greens,blues,col=NA,colvar=NA,...)
+}
+\arguments{
+ \item{x,y}{Numeric vectors or a list with at least two components,
+  the first two of which must be named x and y.}
+ \item{reds,greens,blues}{Color ranges into which to scale the
+  numeric values.}
+ \item{col}{One or more colors to use for the resultant lines. Will
+  be recycled if necessary.}
+ \item{colvar}{A numeric vector from which to scale the colors.}
+ \item{...}{Additional arguments passed to \samp{segments}.}
+}
+\details{
+ \samp{color.scale.lines} displays line segments that can be individually
+  colored according to a variety of methods. In order of precedence, if
+  \samp{col} is not NA, the color values passed will be used. If
+  \samp{colvar} is not NA, the function will call \samp{color.scale} with
+  the three color range arguments to determine the line colors. If
+  \samp{colvar} is the same length as \samp{length(x)-1}, exactly enough 
+  colors for the number of lines displayed will be calculated. If shorter,
+  some colors will be recycled and if longer, some colors will not be used.
+  Finally, the values in \samp{y} will be color-scaled if both of the above
+  arguments are NA. Thus the user can pass predetermined colors, use colors
+  scaled from an arbitrary vector of numerical values or use the \samp{y}
+  values. See \samp{color.scale} for an explanation of specifying color
+  ranges.
+}
+\note{
+ The function is useful for highlighting a numeric dimension or adding
+ an extra "dimension" to a plot.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{color.scale}}
+\examples{
+ # color a random walk "hot" (red) to "cold" (blue) on its distance
+ # from the starting point
+ x<-c(0,cumsum(rnorm(99)))
+ y<-c(0,cumsum(rnorm(99)))
+ xydist<-sqrt(x*x+y*y)
+ plot(x,y,main="Random walk plot",xlab="X",ylab="Y",type="n")
+ color.scale.lines(x,y,c(1,1,0),0,c(0,1,1),colvar=xydist,lwd=2)
+ boxed.labels(x,y,labels=1:100,border=FALSE,cex=0.5)
+ # now color the lines to show whether each step went away from
+ # or toward the starting position
+ color.scale.lines(x,y,col=2+(diff(xydist)>0))
+ boxed.labels(x,y,labels=1:100,border=FALSE,cex=0.5)
+}
+\keyword{misc}
diff --git a/man/color2D.matplot.Rd b/man/color2D.matplot.Rd
new file mode 100755
index 0000000..d1be25c
--- /dev/null
+++ b/man/color2D.matplot.Rd
@@ -0,0 +1,134 @@
+\name{color2D.matplot}
+\alias{color2D.matplot}
+\title{Display a numeric matrix as color matrix}
+\description{
+ Display the values of a numeric 2D matrix or data frame as colored
+  rectangles or hexagons.
+}
+\usage{
+ color2D.matplot(x,cs1=c(0,1),cs2=c(0,1),cs3=c(0,1),
+  extremes=NA,cellcolors=NA,show.legend=FALSE,nslices=10,xlab="Column",
+  ylab="Row",do.hex=FALSE,axes=TRUE,show.values=FALSE,vcol=NA,vcex=1,
+  border="black",na.color=NA,xrange=NULL,color.spec="rgb",yrev=TRUE,
+  xat=NULL,yat=NULL,Hinton=FALSE,...)
+}
+\arguments{
+ \item{x}{data values}
+ \item{cs1,cs2,cs3}{the color parameters that will be scaled to represent
+  the range of numeric values. (see \samp{color.scale})}
+ \item{extremes}{The colors for the extreme values of \samp{x}. Takes
+  precedence over the color ranges.}
+ \item{cellcolors}{A precalculated matrix of cell colors. This must have
+  the same number of rows and columns as the matrix or it will be
+  uninformative. It can be a vector, but be careTakes precedence over both \samp{extremes}
+  and color ranges.}
+ \item{show.legend}{whether to display a color legend with the
+  extreme numeric values in the lower left corner of the plot. This will
+  force the color specification to "rgb", so if this is different from
+  the color specification requested, call \samp{color.legend} separately.}
+ \item{nslices}{The number of color "slices" in the legend.}
+ \item{xlab,ylab}{axis labels for the plot.}
+ \item{do.hex}{plot packed hexagons instead of rectangles.}
+ \item{axes}{Whether to suppress the default axis labelling.}
+ \item{show.values}{Whether to display the numeric values of \samp{x}.
+  This also controls the number of decimal places displayed.}
+ \item{vcol}{The color for the value display. If NA, the values are displayed
+  in black or white depending upon the darkness of the cell color.}
+ \item{vcex}{The character expansion for the value display.}
+ \item{border}{The color(s) for the borders of the cells. Pass NA
+  if no border is  wanted.}
+ \item{na.color}{The color to use for NA values of \samp{x}.}
+ \item{xrange}{An explicit range for the transformation of colors.
+  see \samp{color.scale}}
+ \item{color.spec}{The color specification system to use.}
+ \item{yrev}{Whether to reverse the order of the y-axis to display the
+  cells in "reading" order (left to right and top to bottom) if TRUE,
+  or in the order of a typical plot (left to right and bottom to top) if
+  FALSE.}
+ \item{xat,yat}{Values at which to place tick marks to override \samp{pretty}.}
+ \item{Hinton}{Whether to display a Hinton diagram in which the magnitude of
+  cell values is proportional to the size of the squares and the sign is
+  indicated by the color of the squares.}
+ \item{...}{arguments passed to \samp{plot}.}
+}
+\value{nil}
+\details{
+ Displays a plot with the same number of rectangular or hexagonal cells as
+ there are numeric values in the matrix or data frame. Each rectangle is
+ colored to represent its corresponding value. The rectangles are arranged
+ in the conventional display of a 2D matrix with rows beginning at the top
+ and columns at the left. To get the rows beginning at the bottom, use
+ \samp{yrev=FALSE}. The color scale defaults to black for the minimum
+ value and white for the maximum.
+ 
+ The user will have to adjust the plot device dimensions to get regular
+ squares or hexagons, especially when the matrix is not square. As the
+ margins are not equivalent for all display devices, this is currently
+ a matter of trial and error. Drawing hexagons is quite slow.
+ 
+ \samp{show.values} and \samp{show.legend} are also used to control the
+ number of decimal places displayed if the values or legend are shown.
+ \samp{TRUE} will give one decimal place, \samp{2} two, and so on.
+
+ if \samp{Hinton} is TRUE, a Hinton diagram in which the sizes of the
+ squares are proportional to the absolute value of \samp{x} and the colors
+ of the squares indicate the sign of the \samp{x} values will be displayed.
+ This only works with squares.
+}
+\note{
+ The function \link{image} performs almost the same when passed a
+ matrix of values without grid positions, except that it assigns values to
+ a specified list of colors rather than calculating a color for each distinct
+ value.
+}
+\author{Jim Lemon (thanks to Ashoka Polpitiya for \samp{axes})}
+\seealso{\link{color.scale}, \link{fill.corner}, \link{image}}
+\examples{
+ x<-matrix(rnorm(1024),nrow=32)
+ # simulate a correlation matrix with values -0.5 to 0.5
+ x<-rescale(x,c(-0.5,0.5))
+ # add a column with the extreme values (-1,1) to calculate
+ # the colors, then drop the extra column in the result
+ cellcol<-color.scale(cbind(x,c(-1,rep(1,31))),c(0,1),0,c(1,0))[,1:32]
+ color2D.matplot(x,cellcolors=cellcol,main="Blue to red correlations")
+ # do the legend call separately to get the full range
+ color.legend(0,-4,10,-3,legend=c(-1,-0.5,0,0.5,1),
+  rect.col=color.scale(c(-1,-0.5,0,0.5,1),c(0,1),0,c(1,0)),align="rb")
+ x<-matrix(rnorm(100),nrow=10)
+ # generate colors that show negative values in red to brown
+ # and positive in blue-green to green
+ cellcol<-matrix(rep("#000000",100),nrow=10)
+ cellcol[x<0]<-color.scale(x[x<0],c(1,0.8),c(0,0.8),0)
+ cellcol[x>0]<-color.scale(x[x>0],0,c(0.8,1),c(0.8,0))
+ # now do hexagons without borders
+ color2D.matplot(x,cellcolors=cellcol,xlab="Columns",ylab="Rows",
+  do.hex=TRUE,main="2D matrix plot (hexagons)",border=NA)
+ # for this one, we have to do the color legend separately
+ # because of the two part color scaling
+ legval<-seq(min(x),max(x),length.out=6)
+ legcol<-rep("#000000",6)
+ legcol[legval<0]<-color.scale(legval[legval<0],c(1,0.8),c(0,0.8),0)
+ legcol[legval>0]<-color.scale(legval[legval>0],0,c(0.8,1),c(0.8,0))
+ color.legend(0,-1.8,3,-1.4,round(c(min(x),0,max(x)),1),rect.col=legcol)
+ # do a color only association plot
+ xt<-table(sample(1:10,100,TRUE),sample(1:10,100,TRUE))
+ observed<-xt[,rev(1:dim(xt)[2])]
+ expected<-outer(rowSums(observed),colSums(observed),"*")/sum(xt)
+ deviates<-(observed-expected)/sqrt(expected)
+ cellcol<-matrix(rep("#000000",100),nrow=10)
+ cellcol[deviates<0]<-
+  color.scale(deviates[deviates<0],c(1,0.8),c(0,0.5),0)
+ cellcol[deviates>0]<-
+  color.scale(deviates[deviates>0],0,c(0.7,0.8),c(0.5,0))
+ color2D.matplot(x=round(deviates,2),cellcolors=cellcol,
+  show.values=TRUE,main="Association plot")
+ # Hinton diagram
+ border.col<-color.scale(x,extremes=2:3)
+ color2D.matplot(x,extremes=c(2,3),main="Hinton diagram (green +, red -)",
+  Hinton=TRUE,border=border.col)
+ # waffle plot of percentages with two contributing elements
+ waffle.col<-fill.corner(c(rep("red",18),rep("blue",45)),10,10)
+ color2D.matplot(matrix(1:100,nrow=10),cellcolors=waffle.col,yrev=FALSE,
+  border="lightgray",xlab="",ylab="",main="Waffle plot",axes=FALSE)
+}
+\keyword{misc}
diff --git a/man/corner.label.Rd b/man/corner.label.Rd
new file mode 100755
index 0000000..86576ac
--- /dev/null
+++ b/man/corner.label.Rd
@@ -0,0 +1,38 @@
+\name{corner.label}
+\alias{corner.label}
+\title{Find corner locations and optionally display a label}
+\description{
+ Finds the coordinates in user parameters of a specified corner of the
+ figure region and optionally displays a label there
+}
+\usage{
+ corner.label(label=NULL,x=-1,y=1,xoff=NA,yoff=NA,figcorner=FALSE,...)
+}
+\arguments{
+ \item{label}{Text to display. The default is to display nothing.}
+ \item{x}{an integer value: -1 for the left side of the plot, 1 for the
+  right side}
+ \item{y}{an integer value: -1 for the bottom side of the plot, 1 for
+  the top side}
+ \item{xoff,yoff}{Horizontal and vertical text offsets. Defaults to one
+  half of the width and height of "m" respectively. }
+ \item{figcorner}{Whether to find/display at the corner of the plot or figure.}
+ \item{...}{further arguments to the \samp{text} command for the label}
+}
+\details{
+ \samp{corner.label} finds the specified corner of the plot or figure and if
+ \samp{label} is not NULL, displays it there. The text justification is specified
+ so that the label will be justified away from the corner. To get the label
+ squeezed right into a corner, set \samp{xoff} and \samp{yoff} to zero.
+}
+\value{
+ A list of the x and y positions of the corner adjusted for the offsets.
+}
+\author{Ben Bolker}
+\examples{
+ plot(1:10,1:10)
+ corner.label("A")
+ corner.label(x=1,y=1)
+ corner.label("B",y=-1,x=1,figcorner=TRUE,col="red")
+}
+\keyword{aplot}
diff --git a/man/count.overplot.Rd b/man/count.overplot.Rd
new file mode 100755
index 0000000..35d8d9e
--- /dev/null
+++ b/man/count.overplot.Rd
@@ -0,0 +1,31 @@
+\name{count.overplot}
+\alias{count.overplot}
+\title{Show overlying points as counts}
+\usage{
+ count.overplot(x,y,tol=NULL,col=par("fg"),pch="1",...)
+}
+\arguments{
+ \item{x,y}{Two numeric data vectors or the first two columns of a matrix
+  or data frame. Typically the x/y coordinates of points to be plotted.}
+ \item{tol}{The largest distance between points that will be considered
+  to be overlying.}
+ \item{col}{Color(s) for the points (not the numbers).}
+ \item{pch}{Symbol(s) to display.}
+ \item{...}{additional arguments passed to \samp{plot}.}
+}
+\description{
+ \samp{count.overplot} checks for overlying points defined as points
+  separated by a maximum of \samp{tol}, a two element numeric vector of
+  the x and y tolerance.  Defaults to 1/2 of the width of a lower case 
+  "o" in the x direction and 1/2 of the height of a lower case "o" in 
+  the y direction.
+}
+\value{nil}
+\keyword{misc}
+\author{Jim Lemon}
+\seealso{\link{cluster.overplot},\link{sizeplot}}
+\examples{
+ xy.mat<-cbind(sample(1:10,200,TRUE),sample(1:10,200,TRUE))
+ count.overplot(xy.mat,main="count.overplot",
+  xlab="X values",ylab="Y values")
+}
diff --git a/man/cylindrect.Rd b/man/cylindrect.Rd
new file mode 100755
index 0000000..50ed7bf
--- /dev/null
+++ b/man/cylindrect.Rd
@@ -0,0 +1,39 @@
+\name{cylindrect}
+\alias{cylindrect}
+\title{Display an apparent cylinder}
+\description{Display rectangles shaded to appear like cylinders.}
+\usage{
+ cylindrect(xleft,ybottom,xright,ytop,col,border=NA,gradient="x",nslices=50)
+}
+\arguments{
+ \item{xleft}{The position of the left side of the rectangle(s).}
+ \item{ybottom}{The position of the bottom of the rectangle(s).}
+ \item{xright}{The position of the right side of the rectangle(s).}
+ \item{ytop}{The position of the top side of the rectangle(s).}
+ \item{col}{The base color(s) of the rectangles.}
+ \item{border}{Whether to draw a border and what color.}
+ \item{gradient}{Whether to vary the shading horizontally ("x" - the default)
+  or vertically (anything but "x").}
+ \item{nslices}{The number of "slices" of color for shading.}
+}
+\value{The base color(s) of the rectangle(s).}
+\details{
+ \samp{cylindrect} displays a rectangle filled with "slices" of color that
+ simulate the appearance of a cylinder. The slices are calculated so that the 
+ base color appears at the right or bottom edge of the rectangle, becomes
+ progressively lighter to a "highlight" at two thirds of the width or height
+ and then darkens toward the base color again.
+
+ The appearance is of a cylinder lit from above and to the left of the viewer.
+ The position of the apparent light source is hard coded into the function.
+}
+\author{Jim Lemon}
+\seealso{\link{gradient.rect}}
+\examples{
+ plot(0,xlim=c(0,5),ylim=c(0,5),main="Examples of pseudocylindrical rectangles",
+  xlab="",ylab="",axes=FALSE,type="n")
+ cylindrect(0,0,1,5,"red")
+ cylindrect(rep(1,3),c(0,2,4),rep(4,3),c(1,3,5),"green",gradient="y")
+ cylindrect(4,0,5,5,"#8844aa")
+}
+\keyword{misc}
diff --git a/man/death_reg.Rd b/man/death_reg.Rd
new file mode 100644
index 0000000..09e6a6f
--- /dev/null
+++ b/man/death_reg.Rd
@@ -0,0 +1,11 @@
+\name{death_reg}
+\alias{death_reg}
+\title{Death registrations from 1996 to 2010}
+\description{
+ Death registrations for underlying cause of death as ICD-10 chapters for 1996
+ to 2010.
+}
+\usage{
+ data(death_reg)
+}
+\keyword{misc}
diff --git a/man/dendroPlot.Rd b/man/dendroPlot.Rd
new file mode 100644
index 0000000..99ef3e9
--- /dev/null
+++ b/man/dendroPlot.Rd
@@ -0,0 +1,66 @@
+\name{dendroPlot}
+\alias{dendroPlot}
+\title{ Display distributions as dendrites }
+\description{
+ Display the distributions of one or more sets of points as branching
+  (dendritic) clusters.
+}
+\usage{
+ dendroPlot(x,breaks=list(10,10,10),pch=1,col=par("fg"),cex=1,nudge=NA,
+  setlabels=NA,...)
+}
+\arguments{
+ \item{x}{A list or data frame of numeric or factor or character
+  columns.}
+ \item{breaks}{A list of cutpoints to transform numeric values into factors
+  (see \link{cut}). Must be at least one number >= 2.}
+ \item{pch}{Symbol(s) to use in plotting the values.}
+ \item{col}{Color(s) for the symbols.}
+ \item{cex}{Size of the symbol(s) to use in plotting.}
+ \item{nudge}{The amount to set each consecutive value in a category away from
+  the center of the dendrite.}
+ \item{setlabels}{Labels to place along the abcissa to identify the sets.}
+ \item{...}{Other arguments passed to plot.}
+}
+\details{
+ \samp{dendroPlot} displays the distributions of categorical values as stacks
+ of "branches". The lengths of the branches show the number of values in each
+ category, rather like the opposed bars in a pyramid plot, except that there
+ is no separation of groups. The distribution of numeric values can also be
+ displayed by passing a set of breakpoints to categorize the values. The
+ breakpoints will usually be equidistant, but unevenly spaced breakpoints can
+ be passed. If an element of \samp{x} is numeric, the values of the
+ corresponding \samp{x} element will be used to place the points, but the
+ branches will be defined as the categories formed by applying the breaks to
+ those numeric values.
+
+ Note that in the first example, the breakpoints for the first and third elements
+ are used to define the ten branches for each. The second element of \samp{x}
+ is already categorical, so the breakpoints are ignored. When comparing 
+ distributions with very different ranges it may be necessary to adjust the
+ breakpoints to get a satisfactory result.
+
+ Each successive point in a category is \samp{nudge}d away from the center
+ of the dendrite. If \samp{nudge} has more than one value, the points will be
+ nudged up and down for categorical variables to enable closer packing. The
+ second value of \samp{nudge} is ignored for numeric variables. The aspect
+ ratio of the plot, the character expansion and the nudging will have to be
+ adjusted to give the best point spacing for most dendroPlots.
+}
+\note{The \samp{ehplot} function is a much more versatile instantiation of this
+ type of plot. \samp{dendroPlot} has been retained as there are currently a few
+ differences that some users may find valuable. However, it is not impossible
+ that \samp{dendroPlot} will disappear in the future. Another very useful version
+ of this type of plot is \samp{beeswarm} in the \pkg{beeswarm} package.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{ehplot}}
+\examples{
+ x<-list(runif(90,1,3),factor(sample(LETTERS[1:10],100,TRUE)),rnorm(80,mean=5))
+ dendroPlot(x,xlab="Groups",ylab="Value of x",main="Test dendroPlot I")
+ # now apply a nudge factor and different breaks
+ dendroPlot(x,breaks=list(8,10,10),nudge=c(0.05,0.1),
+  xlab="Groups",ylab="Value of x",main="Test dendroPlot II")
+}
+\keyword{misc}
diff --git a/man/diamondplot.Rd b/man/diamondplot.Rd
new file mode 100755
index 0000000..3a263c9
--- /dev/null
+++ b/man/diamondplot.Rd
@@ -0,0 +1,28 @@
+\name{diamondplot}
+\alias{diamondplot}
+\title{Plot multiple variables as polygons on a radial grid}
+\usage{
+ diamondplot(x, bg=gray(0.6), col=rainbow,name="", ...)
+}
+\arguments{
+ \item{x}{A data frame containing numeric values that represent attributes
+  (possibly repeated observations) of data objects. See the example.}
+ \item{bg}{The background color for the plot.}
+ \item{col}{The colors for the polygons.}
+ \item{name}{The title for the plot (i.e. \samp{main}).}
+ \item{...}{additional arguments passed to \samp{plot}.}
+}
+\description{
+ \samp{diamondplot} displays a plot of polygons on a radial grid representing
+ the relationships between one or more attributes of data objects. For a slightly
+ different style of plot, see the "spiderweb plot" example in \samp{radial.plot}.
+}
+\value{nil}
+\author{Elisa Biancotto}
+\keyword{misc}
+\seealso{\link{plot}, \link{radial.plot}}
+\examples{
+ data(mtcars)
+ mysubset<-mtcars[substr(dimnames(mtcars)[[1]],1,1)=="M",c("mpg","hp","wt","disp")]
+ diamondplot(mysubset)
+}
diff --git a/man/dispersion.Rd b/man/dispersion.Rd
new file mode 100755
index 0000000..6232a63
--- /dev/null
+++ b/man/dispersion.Rd
@@ -0,0 +1,84 @@
+\name{dispersion}
+\alias{dispersion}
+\alias{dispbars}
+\title{ Display a measure of dispersion. }
+\description{
+ Display lines or capped bars at specified points on a plot representing
+  measures of dispersion.
+}
+\usage{
+ dispersion(x,y,ulim,llim=ulim,intervals=TRUE,arrow.cap=0.01,arrow.gap=NA,
+  type="a",fill=NA,lty=NA,pch=NA,border=NA,col=par("fg"),display.na=TRUE,
+  ...)
+}
+\arguments{
+ \item{x,y}{x and y position of the centers of the bars}
+ \item{ulim,llim}{The extent of the dispersion measures.}
+ \item{arrow.cap}{The width of the cap at the outer end of each bar
+  as a proportion of the width of the plot.}
+ \item{arrow.gap}{The gap to leave at the inner end of each bar.
+  Defaults to two thirds of the height of a capital "O".}
+ \item{intervals}{Whether the limits are intervals (TRUE) or absolute values
+  (FALSE).}
+ \item{type}{What type of display to use.}
+ \item{fill}{Color to fill between the lines if \samp{type} is not NULL and
+  \samp{fill} is not NA.}
+ \item{lty}{Line type for redrawing the lines if necessary.}
+ \item{pch}{Symbol for redrawing the points if necessary.}
+ \item{border}{Line type for drawing a border on the confidence band.}
+ \item{col}{Color for the lines or capped bars.}
+ \item{display.na}{Whether to display NA values as lines going off the plot.}
+ \item{...}{additional arguments passed to \samp{arrows} or \samp{lines}
+  depending upon \samp{type}.}
+}
+\details{
+ \samp{dispersion} displays a measure of dispersion on an existing plot.
+ Currently it will display either vertical lines with caps (error bars) or lines
+ that form a "confidence band" around a line of central tendency. If \samp{fill}
+ is not NA and \samp{type} is \samp{"l"}, a polygon will be drawn between the
+ confidence lines. Remember that any points or lines within the confidence band
+ will be obscured, so pass point and/or line types as in the second example.
+
+ The default behavior is to display an undefined dispersion (e.g. a variance with
+ only one observation) as a line going off the plot. If \samp{display.na} is FALSE,
+ NA values will not be displayed, allowing the user to show only upper or lower
+ dispersion limits.
+
+ The \samp{intervals} argument allows the user to pass the limits as either
+ intervals (the default) or absolute values.
+
+ If \samp{arrow.gap} is greater than or equal to the upper or lower
+ limit for a bar, \samp{segments} is used to draw the upper and
+ lower caps with no bars to avoid zero length arrows.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{arrows}, \link{segments},\link{lines}}
+\examples{
+ disptest<-matrix(rnorm(200),nrow=20)
+ disptest.means<-rowMeans(disptest)
+ row.order<-order(disptest.means)
+ se.disptest<-unlist(apply(disptest,1,std.error))
+ plot(disptest.means[row.order],main="Dispersion as error bars",
+  ylim=c(min(disptest.means-se.disptest),max(disptest.means+se.disptest)),
+  xlab="Occasion",ylab="Value")
+ dispersion(1:20,disptest.means[row.order],se.disptest[row.order])
+ plot(disptest.means[row.order],main="Dispersion as confidence band",
+  ylim=c(min(disptest.means-se.disptest),max(disptest.means+se.disptest)),
+  xlab="Occasion",ylab="Value")
+ dispersion(1:20,disptest.means[row.order],se.disptest[row.order],type="l",
+  fill="#eeccee",lty=2,pch=1)
+ disptest2<-matrix(sample(c(TRUE,FALSE),200,TRUE),nrow=10)
+ disptest.prop<-rowMeans(disptest2)
+ disptest.ulim<-disptest.llim<-rep(NA,10)
+ for(i in 1:10) {
+  disptest.ulim[i]<-binciWu(disptest2[i,],20)
+  disptest.llim[i]<-binciWl(disptest2[i,],20)
+ }
+ plot(disptest.prop,main="Dispersion as binomial confidence intervals",
+  ylim=c(min(disptest.llim),max(disptest.ulim)),
+  xlab="Sample",ylab="Proportion")
+ dispersion(1:10,disptest.prop,disptest.ulim,disptest.llim,
+  interval=FALSE,lty=2,pch=1)
+}
+\keyword{misc}
diff --git a/man/do.first.Rd b/man/do.first.Rd
new file mode 100644
index 0000000..7af5a91
--- /dev/null
+++ b/man/do.first.Rd
@@ -0,0 +1,16 @@
+\name{do.first}
+\alias{do.first}
+\title{ Execute a graphic function on a plot }
+\description{ do.first allows the user to execute one or more commands before
+ displaying values on a plot. }
+\details{
+ \samp{do.first} is an argument in some plotrix functions that allows the user
+ to do things like add a background color or a grid to the plot before
+ displaying the other plot elements.
+
+ The value of \samp{do.first} should be a character string that can be parsed
+ to one or more valid R commands. Remember to enclose the string in quotes,
+ separate commands with semicolons and escape quotes within the string with
+ backslashes if necessary.
+}
+\keyword{misc}
diff --git a/man/dotplot.mtb.Rd b/man/dotplot.mtb.Rd
new file mode 100755
index 0000000..fafd847
--- /dev/null
+++ b/man/dotplot.mtb.Rd
@@ -0,0 +1,60 @@
+\name{dotplot.mtb}
+\alias{dotplot.mtb}
+\title{ Minitab style dotplots }
+\description{
+ Create a dotplot of a data vector in the sense of ``dotplot'' as
+ used in the Minitab\eqn{\mbox{\copyright}}{\ (copyright)} package.
+}
+\usage{
+dotplot.mtb(x, xlim = NULL, main = NULL, xlab = NULL, ylab = NULL,
+            pch = 19, hist = FALSE, yaxis = FALSE, mtbstyle=TRUE)
+}
+\arguments{
+  \item{x}{ A numeric vector. }
+  \item{xlim}{ The x limits of the plot. }
+  \item{main}{ A title for the plot; defaults to blank.}
+  \item{xlab}{ A label for the x axis; defaults to blank.}
+  \item{ylab}{ A label for the y axis; defaults to blank.}
+  \item{pch}{ The plotting symbol for the dots in the plot;
+              defaults to a solid disc. }
+  \item{hist}{ Logical scalar; should the plot be done ``histogram
+               style, i.e. using vertical lines rather than stacks
+               of dots?}
+  \item{yaxis}{ Logical scalar; should a y-axis be produced? }
+  \item{mtbstyle}{ Logical scalar; should the dotplot be done in
+                   the ``Minitab'' style?  I.e. should the zero level
+                   be at the vertical midway point? }
+}
+\details{
+  The result of \code{hist=TRUE} looks less ugly than stacks of
+  dots for very large data sets.
+}
+\value{
+  Nothing.  A plot is produced as a side effect.
+}
+\author{ Barry Rowlingson
+  \email{B.Rowlingson at lancaster.ac.uk}
+  and Rolf Turner
+  \email{r.turner at auckland.ac.nz}
+}
+\section{Warnings}{
+This function does something toadally different from the \code{dotplot()}
+(now \code{\link{dotchart}()}) function in the graphics package.
+
+The labelling of the \code{y}-axis is device dependent.
+}
+
+\examples{
+\dontrun{
+set.seed(42)
+x <- rpois(100,10)
+dotplot.mtb(x,main="No y-axis.")
+dotplot.mtb(x,yaxis=TRUE,main="With y-axis displayed.")
+dotplot.mtb(x,hist=TRUE,main="An \"h\" style plot.")
+dotplot.mtb(x,xlim=c(4,16),main="With the x-axis limited.")
+dotplot.mtb(x,yaxis=TRUE,mtbstyle=FALSE,main="Non-Minitab style.")
+dotplot.mtb(x,yaxis=TRUE,xlab="x",ylab="count",
+            main="With x and y axis labels.")
+}
+}
+\keyword{ hplot }
diff --git a/man/draw.arc.Rd b/man/draw.arc.Rd
new file mode 100755
index 0000000..4a9e516
--- /dev/null
+++ b/man/draw.arc.Rd
@@ -0,0 +1,55 @@
+\name{draw.arc}
+\alias{draw.arc}
+\title{ Draw arc }
+\description{
+  Draw one or more arcs using classic graphics.
+}
+\usage{
+ draw.arc(x=1,y=NULL,radius=1,angle1=deg1*pi/180,angle2=deg2*pi/180, 
+  deg1=0,deg2=45,n=0.05,col=NA,lwd=NA,...)
+}
+\arguments{
+  \item{x}{ x coordinate of center.  Scalar or vector. }
+  \item{y}{ y coordinate of center.  Scalar or vector. }
+  \item{radius}{ radius.  Scalar or vector.  }
+  \item{angle1}{ Starting angle in radians. Scalar or vector. }
+  \item{angle2}{ Ending angle in radians. Scalar or vector. }
+  \item{deg1}{ Starting angle in degrees. Scalar or vector. }
+  \item{deg2}{ Ending angle in degrees. Scalar or vector. }
+  \item{n}{ Number of polygons to use to approximate the arc. }
+  \item{col}{ Arc colors. }
+  \item{lwd}{Line width for the arc.}
+  \item{...}{ Other arguments passed to segments.  Vectorization 
+   is not supported for these. }
+}
+\details{
+ Draws one or more arcs from \code{angle1} to \code{angle2}.
+ If \code{angle1} is numerically greater than \code{angle2},
+ then the angles are swapped.
+
+ Be sure to use an aspect ratio of 1 as shown in
+ the example to avoid distortion.  For argument 'n' (which may be
+ either a scalar or a vector, although most likely you will leave
+ it at the default value), an integer value means to use that number
+ of segments to approximate the arc, while a non-integer value means
+ to use enough segments so that the angle that successive segments
+ make with one another is no more than n radians.
+}
+\value{
+  Returns a matrix of expanded arguments invisibly.
+}
+\author{Gabor Grothendieck. Improvements by Ted Toal.}
+\examples{
+
+   plot(1:10, asp = 1,main="Test draw.arc")
+   draw.arc(5, 5, 1:10/10, deg2 = 1:10*10, col = "blue")
+   draw.arc(8, 8, 1:10/10, deg2 = 1:10*10, col = 1:10)
+   draw.arc(5, 5, 3, deg1=100, deg2=170, col="gold", lwd=50, lend=1)
+   # example taken from post by Hans Borcher:
+   # https://stat.ethz.ch/pipermail/r-help/2009-July/205728.html
+   # Note setting of aspect ratio to 1 first.
+   curve(sin(x), 0, pi, col="blue", asp=1)
+   draw.arc(pi/2, 0, 1, deg1=45, deg2=135, col="red")
+
+}
+\keyword{misc}
diff --git a/man/draw.circle.Rd b/man/draw.circle.Rd
new file mode 100755
index 0000000..19ca267
--- /dev/null
+++ b/man/draw.circle.Rd
@@ -0,0 +1,34 @@
+\name{draw.circle}
+\alias{draw.circle}
+\title{Draw a circle}
+\description{Draws a circle on an existing plot.}
+\usage{
+ draw.circle(x,y,radius,nv=100,border=NULL,col=NA,lty=1,lwd=1)
+}
+\arguments{
+ \item{x,y}{Coordinates of the center of the circle.}
+ \item{radius}{Radius (or radii) of the circle(s) in user units.}
+ \item{nv}{Number of vertices to draw the circle.}
+ \item{border}{Color to use for drawing the circumference.}
+ \item{col}{Color to use for filling the circle.}
+ \item{lty}{Line type for the circumference.}
+ \item{lwd}{Line width for the circumference.}
+}
+\value{
+ A list with the x and y coordinates of the points on the circumference
+ of the last circle displayed.
+}
+\details{
+ \samp{draw.circle} uses the dimensions of the plot and the \samp{x} and
+ \samp{y} coordinates to draw a circle rather than an ellipse.
+}
+\author{Jim Lemon}
+\seealso{\link{polygon}}
+\examples{
+ plot(1:5,seq(1,10,length=5),type="n",xlab="",ylab="",main="Test draw.circle")
+ draw.circle(2,4,c(1,0.66,0.33),border="purple",
+  col=c("#ff00ff","#ff77ff","#ffccff"),lty=1,lwd=1)
+ draw.circle(2.5,8,0.6,border="red",lty=3,lwd=3)
+ draw.circle(4,3,0.7,border="green",lty=1,lwd=1)
+ draw.circle(3.5,7,0.8,border="blue",lty=2,lwd=2)}
+\keyword{misc}
diff --git a/man/draw.ellipse.Rd b/man/draw.ellipse.Rd
new file mode 100755
index 0000000..7ac14d6
--- /dev/null
+++ b/man/draw.ellipse.Rd
@@ -0,0 +1,69 @@
+\name{draw.ellipse}
+\alias{draw.ellipse}
+\title{Draw ellipse}
+\description{Draws ellipses on an existing plot.}
+\usage{
+draw.ellipse(x, y, a = 1, b = 1, angle = 0, segment = NULL, 
+arc.only = TRUE, deg = TRUE, nv = 100, border = NULL, 
+col = NA, lty = 1, lwd = 1, ...)
+}
+\arguments{
+  \item{x}{
+A vector or a matrix (if \code{y} is missing).}
+  \item{y}{
+A vector, can be missing.
+}
+  \item{a,b}{
+Vectors, radii of the ellypses along the two axes in user units.
+}
+  \item{angle}{
+Angle of rotation in degrees (if \code{deg=TRUE}) or in radians
+ (if \code{deg=FALSE}).
+}
+  \item{segment}{
+Start and endpoints of arc in degrees (if \code{deg=TRUE}) or in radians
+ (if \code{deg=FALSE}).
+}
+  \item{arc.only}{
+Logical, if \code{segmen} the full ellipse is not drawn, radii from the
+ends of the arc are drawn to form a sector (see Examples).
+}
+  \item{deg}{
+Logical, if angles are given in degrees (\code{TRUE}) or radians.
+}
+  \item{nv}{
+Number of vertices to draw the ellipses.
+}
+  \item{border}{
+Color to use for drawing the circumference.
+}
+  \item{col}{
+Color to use for filling the circle.
+}
+  \item{lty}{
+Line type for the circumference.
+}
+  \item{lwd}{
+Line width for the circumference.
+}
+  \item{\dots}{
+Additional arguments passed to \code{\link{polygon}}.
+}
+}
+\value{Draw ellipses as a side effect.}
+\author{Peter Solymos <solymos at ualberta.ca>}
+\seealso{\link{polygon}}
+\examples{
+plot(c(0,10), c(0,10), type="n", main="test draw.ellipse")
+draw.ellipse(c(3,7), c(8,8), c(0.5,1), c(1,0.5), col=c(2,4),
+ angle=c(45,0), segment=rbind(c(0,45),c(45,360)))
+draw.ellipse(c(3,7), c(6,6), c(0.5,1), c(1,0.5), col=c(2,4),
+ angle=c(45,0), segment=rbind(c(0,45),c(45,360)), arc.only=FALSE)
+draw.ellipse(c(3,7), c(4,4), c(0.5,1), c(1,0.5), border=c(2,4),
+ angle=c(45,0), segment=rbind(c(0,45),c(45,360)), arc.only=FALSE)
+draw.ellipse(c(3,7), c(2,2), c(0.5,1), c(1,0.5), border=1,
+ angle=c(45,0), lty=3)
+draw.ellipse(c(3,7), c(2,2), c(0.5,1), c(1,0.5), border=c(5,3),
+ angle=c(45,0), nv=c(3,4), lty=2, lwd=2)
+}
+\keyword{misc}
diff --git a/man/draw.radial.line.Rd b/man/draw.radial.line.Rd
new file mode 100644
index 0000000..6969541
--- /dev/null
+++ b/man/draw.radial.line.Rd
@@ -0,0 +1,53 @@
+\name{draw.radial.line}
+\alias{draw.radial.line}
+\title{Draw a radial line}
+\description{Draws a line radiating from a specified center, optionally
+  expanding the line width as a function of distance from center.}
+\usage{
+ draw.radial.line(start, end, center=c(0, 0), angle=0, deg=NA,
+  expand=FALSE, col=NA, lwd=NA, ...)
+}
+\arguments{
+ \item{start}{Distance from center of circular area to start of line in
+  x/y user units.}
+ \item{end}{Distance from center of circular area to end of line in x/y
+  user units.}
+ \item{center}{The center of the circular area in x/y user units.}
+ \item{angle}{The angular position of the line in radians.}
+ \item{deg}{The angular position of the line in degrees
+  (takes precedence if not NA).}
+ \item{expand}{TRUE to expand line width in proportion to distance from
+  center.}
+ \item{col}{The color of the line, NA for par("col").}
+ \item{lwd}{The width of the line in device-specific units,
+  NA for par("lwd").}
+ \item{...}{Arguments passed to 'lines' (expand=FALSE) or 'polygon'
+  (expand=TRUE).}
+}
+\value{nil}
+\details{
+ If the user passes a value for 'deg', this overrides any value passed
+ to 'angle'.
+
+ If 'expand' is FALSE, the line width is constant (as specified by par("lwd").
+
+ If 'expand' is TRUE, the line width is equal to the lwd value at distance
+ 'end' and contracts as it moves towards 'start'.  When expand is 'TRUE',
+ lty is ignored.
+}
+\author{Ted Toal}
+\seealso{\link{lines}, link{draw.arc}}
+\examples{
+ plot(0, xlim=c(1,5), ylim=c(1,5), main="Test of radial lines", xlab="", ylab="", type="n")
+ points(3, 3, pch=20)
+ draw.radial.line(1, 2, center=c(3,3))
+ draw.radial.line(1, 2, center=c(3,3), angle=pi/4)
+ draw.radial.line(1, 2, center=c(3,3), angle=pi/4+0.1, col="blue", lwd=4, lty=3)
+ draw.radial.line(0.2, 1.2, center=c(3,3), deg=120, col="red", lwd=10)
+ draw.radial.line(0.2, 1.2, center=c(3,3), deg=145, col="purple", lwd=10, lend=1)
+ draw.radial.line(0.5, 2, center=c(3,3), deg=225, expand=TRUE, col="gold")
+ draw.radial.line(0.7, 1.4, center=c(3,3), deg=180, expand=TRUE, col="orange", lwd=30)
+ draw.radial.line(0.5, 1.5, center=c(3,3), deg=235, expand=TRUE, lwd=5, col="brown")
+ draw.radial.line(0.1, 1.5, center=c(3,3), deg=325, expand=TRUE, lwd=5, col="green")
+}
+\keyword{misc}
diff --git a/man/draw.tilted.sector.Rd b/man/draw.tilted.sector.Rd
new file mode 100755
index 0000000..8b4c8de
--- /dev/null
+++ b/man/draw.tilted.sector.Rd
@@ -0,0 +1,40 @@
+\name{draw.tilted.sector}
+\alias{draw.tilted.sector}
+\title{Display a 3D pie sector}
+\description{
+ Displays a 3D pie sector.
+}
+\usage{
+ draw.tilted.sector(x=0,y=0,edges=NA,radius=1,height=0.1,theta=pi/6,
+  start=0,end=pi*2,border=par("fg"),col=par("bg"),explode=0,shade=0.8)
+}
+\arguments{
+ \item{x,y}{Position of the center of the pie sector in user units}
+ \item{edges}{Number of edges to draw a complete ellipse}
+ \item{radius}{the radius of the pie in user units}
+ \item{height}{the height of the pie in user units}
+ \item{theta}{The angle of viewing in radians}
+ \item{start}{Starting angle of the sector}
+ \item{end}{Ending angle of the sector}
+ \item{border}{The color of the sector border lines}
+ \item{col}{Color of the sector}
+ \item{explode}{How far to "explode" the sectors in user units}
+ \item{shade}{If > 0 and < 1, the proportion to reduce the
+  brightness of the sector color to get a better 3D effect.}
+}
+\value{
+ The bisector of the pie sector in radians.
+}
+\details{
+ \samp{draw.tilted.sector} displays a single 3D pie sector. It is probably
+ only useful when called from \link{pie3D}. The \samp{shade}
+ argument proportionately reduces the brightness of the RGB color of
+ the sector to produce a top lighted effect.
+
+ If \samp{explode} is zero, only the top and outer side of each
+ sector will be displayed. This will sometimes fix the problem of a pie with
+ one huge sector greater than 3*pi/2 that cannot otherwise be drawn.
+}
+\author{Jim Lemon}
+\seealso{\link{pie3D}}
+\keyword{misc}
diff --git a/man/drawNestedBars.Rd b/man/drawNestedBars.Rd
new file mode 100755
index 0000000..e7c4bd7
--- /dev/null
+++ b/man/drawNestedBars.Rd
@@ -0,0 +1,43 @@
+\name{drawNestedBars}
+\alias{drawNestedBars}
+\title{Display nested bars}
+\description{Displays the nested bars for barNest.}
+\usage{
+ drawNestedBars(x,start,end,shrink=0.1,errbars=FALSE,intervals=TRUE,col=NA,
+ labelcex=1,lineht=NA,showall=TRUE,Nwidths=FALSE,barlabels=NULL,
+ showlabels=TRUE,arrow.cap=NA)
+}
+\arguments{
+ \item{x}{One level of the breakdown produced by \samp{brkdnNest}.}
+ \item{start,end}{The left and right x coordinates for the bar or group of bars
+  to be displayed.}
+ \item{shrink}{The proportion to shrink the width of the bars at each level.}
+ \item{errbars}{Whether to display error bars on the bars.}
+ \item{intervals}{Whether to use offsets or absolute values when displaying
+  measures of dispersion.}
+ \item{col}{The colors to use to fill the bars. See Details.}
+ \item{labelcex}{Character size for the group labels.}
+ \item{lineht}{The height of a margin line in user units.}
+ \item{showall}{Whether to display the bars at any levels above the last.}
+ \item{Nwidths}{Whether to scale the widths of the bars to the number of
+  observations.}
+ \item{barlabels}{Optional labels to display below the bars.}
+ \item{showlabels}{Whether to display the labels below the bars.}
+ \item{arrow.cap}{The width of the "cap" on error bars in user units,
+  defaulting to 0.01 of the width of the plot.}
+}
+\value{nil}
+\details{
+ \samp{drawNestedBars} displays the bars for the nested breakdown performed
+ by \samp{brkdnNest}. It starts at the top of the list and calls itself for
+ each level of the breakdown. It is unlikely to be useful for anything else.
+
+ The combination of \samp{showlabels=TRUE} and \samp{showall=FALSE} allows
+ the display of all of the labels below the plot with only the last set of
+ bars being displayed. To have a set of labels not displayed, pass explicit
+ \samp{barlabels} and have zero length labels for the level that is not to
+ have labels.
+}
+\author{Jim Lemon and Ofir Levy}
+\seealso{\link{brkdnNest}, \link{drawNestedBars}}
+\keyword{misc}
diff --git a/man/drawSectorAnnulus.Rd b/man/drawSectorAnnulus.Rd
new file mode 100644
index 0000000..4d970ec
--- /dev/null
+++ b/man/drawSectorAnnulus.Rd
@@ -0,0 +1,23 @@
+\name{drawSectorAnnulus}
+\alias{drawSectorAnnulus}
+\title{Display a radial pie sector}
+\description{
+ Displays a radial pie sector with optional annuli.
+}
+\usage{
+ drawSectorAnnulus(angle1,angle2,radius1,radius2,col,angleinc=0.03)
+}
+\arguments{
+ \item{angle1,angle2}{Start and end angle for the sector.}
+ \item{radius1,radius2}{Start and end of the radial extent of the annulus.}
+ \item{col}{Color of the sector.}
+ \item{angleinc}{The angular increment to use in drawing the arcs.}
+}
+\value{nil}
+\details{
+ \samp{drawSectorAnnulus} displays a single radial pie sector. It is probably
+ only useful when called from \link{radial.pie}.
+}
+\author{Jim Lemon}
+\seealso{\link{radial.pie}}
+\keyword{misc}
diff --git a/man/ehplot.Rd b/man/ehplot.Rd
new file mode 100644
index 0000000..0f58572
--- /dev/null
+++ b/man/ehplot.Rd
@@ -0,0 +1,87 @@
+\name{ehplot}
+\alias{ehplot}
+%- Also NEED an '\alias' for EACH other topic documented here.
+\title{
+  Engelmann-Hecker-Plot - EH-Plot
+}
+\description{
+  This R function provides a convenient way to visualize the distribution of 
+  grouped numerical data.
+}
+\usage{
+  ehplot(data, groups, intervals=50, offset=0.1, log=FALSE,
+         median=TRUE, box=FALSE, boxborder="grey50",
+         xlab="groups", ylab="values", col="black",
+         add=FALSE, sort=TRUE, ...)
+}
+\arguments{
+  \item{data}{
+    Vector of numerical data.
+}
+  \item{groups}{
+    Vector of group names which should have the same length as data.
+}
+  \item{intervals}{
+    The data is splitted into a certain number of intervals. If data
+    points are in the same interval they are drawn side-by-side.
+}
+  \item{offset}{
+    x-distance between two data points at the same interval.
+}
+  \item{log}{
+    Logarithmic display
+}
+  \item{median}{
+    To show the median of each group. NAs in data are not considered
+    for calculating the medians.
+}
+  \item{box}{
+    To underlay a boxplot.
+}
+  \item{boxborder}{
+    The color of the boxplot if a boxplot is drawn.
+}
+  \item{xlab}{
+    x-axis label
+}
+  \item{ylab}{
+    y-axis label
+}
+  \item{col}{
+    vector of colors for the datapoints. (recycled as necessary).
+}
+  \item{add}{
+    add this plot to an existing one (i.e. do not call plot.new).
+}
+  \item{sort}{
+    normally, the groups are sorted by name. To keep the order as provided in
+    the groups-vector, set this to FALSE
+}
+  \item{\dots}{
+    additional plot-parameters will be passed to the plot-function
+}
+
+}
+\author{
+  Robby Engelmann <robby.engelmann at med.uni-rostock.de> and
+  Michael Hecker <michael.hecker at rocketmail.com>
+}
+
+\examples{
+data(iris)
+ehplot(iris$Sepal.Length, iris$Species, intervals=20, cex=1.8, pch=20)
+ehplot(iris$Sepal.Width, iris$Species, intervals=20, box=TRUE, median=FALSE)
+ehplot(iris$Petal.Length, iris$Species, pch=17, col="red", log=TRUE)
+ehplot(iris$Petal.Length, iris$Species, offset=0.06, pch=as.numeric(iris$Species))
+
+# Groups don't have to be presorted:
+rnd <- sample(150)
+plen <- iris$Petal.Length[rnd]
+pwid <- abs(rnorm(150, 1.2))
+spec <- iris$Species[rnd]
+ehplot(plen, spec, pch=19, cex=pwid, col=rainbow(3, alpha=0.6)[as.numeric(spec)])
+}
+% Add one or more standard keywords, see file 'KEYWORDS' in the
+% R documentation directory.
+\keyword{ ~kwd1 }
+\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
diff --git a/man/election.Rd b/man/election.Rd
new file mode 100644
index 0000000..ebb03ce
--- /dev/null
+++ b/man/election.Rd
@@ -0,0 +1,62 @@
+\name{election}
+\alias{election}
+\title{Assign party members to seats}
+\description{Create a layout for an election result in an assembly}
+\usage{
+ election(seats,result,formula,colours = sample(rainbow(length(counts))))
+}
+\arguments{
+ \item{seats}{A data frame of x and y positions, row numbers and angles
+  (usually the output from the seats function).}
+ \item{result}{A data frame with party names and seat counts.}
+ \item{formula}{A formula with the party name column on the left and the
+  count column on the right. Think of the twiddle symbol as "got".}
+ \item{colours}{A vector of colours. If missing a random rainbow is used.
+  This may cause Green parties to show as red.}
+}
+\value{
+ A data frame including:
+ \item{x}{The x positions of the seats to be plotted on semi-circular
+  arcs.}
+ \item{y}{The y positions of the seats to be plotted on semi-circular
+  arcs.}
+ \item{r}{The row numbers for each seat.}
+ \item{theta}{The angle of each seat, going from pi to zero radians.}
+ \item{party}{The labels for the party holding each seat.}
+ \item{colour}{The colour that has been assigned to the party.}
+}
+\author{Barry Rowlingson}
+\seealso{\link{seats}}
+\examples{
+ # The EU parliament has 751 seats, and Wikipedia currently shows this
+ eu = structure(list(colour = c("#3399FF", "#F0001C", "#0054A5", "#FFD700",
+ "#990000", "#909090", "#32CD32", "#40E0D0"), party = c("EPP",
+ "S and D", "ECR", "ALDE", "GUE-NGL", "Non-Inscrits", "Greens-EFA",
+ "EFDD"), members = c(220L, 191L, 70L, 68L, 52L, 52L, 50L, 48L
+ )), .Names = c("colour", "party", "members"), row.names = c(NA,
+ -8L), class = "data.frame")
+ strasbourg = seats(751, 16)
+ eugov = election(strasbourg, eu, party~members, colours=eu$colour)
+ oldmar<-par(mar=c(2,4,4,2))
+ plot(eugov$x, eugov$y, col=eugov$colour, asp=1, pch=19, ylim=c(-2,2.5),
+  xlab="", ylab="", main="EU Parliament 2014", axes=FALSE)
+ legend(-0.7,-0.3,eu$party,fill=eu$colour)
+ par(oldmar)
+ # or using ggplot2
+ \dontrun{ 
+  require(ggplot2)
+  blank = theme(axis.line=element_blank(),
+        axis.text.x=element_blank(),
+  axis.text.y=element_blank(),
+  axis.ticks=element_blank(),
+  axis.title.x=element_blank(),
+  axis.title.y=element_blank(),
+  panel.background=element_blank(),
+  panel.border=element_blank(),
+  panel.grid.major=element_blank(),
+  panel.grid.minor=element_blank(),
+  plot.background=element_blank())
+  ggplot(eugov, aes(x=x,y=y,col=party)) + geom_point() + coord_fixed() + blank
+ }
+}
+\keyword{misc}
diff --git a/man/emptyspace.Rd b/man/emptyspace.Rd
new file mode 100755
index 0000000..74c4f3a
--- /dev/null
+++ b/man/emptyspace.Rd
@@ -0,0 +1,38 @@
+\name{emptyspace}
+\alias{emptyspace}
+\title{ Find an empty space on a plot }
+\description{
+ Try to find the largest empty rectangle on a plot.
+}
+\usage{
+ emptyspace(x,y=NULL)
+}
+\arguments{
+ \item{x,y}{x and y positions of the points on the plot.}
+}
+\details{
+ \samp{emptyspace} searches the pairs of points on the plot to find
+ the largest rectangular space within which none of the points lie.
+ It does not guarantee that the space will be large enough to fit a
+ legend or text.
+ 
+ Two alternatives are the \samp{largest.empty} function in the 
+ \pkg{Hmisc} package and the \samp{maxEmptyRect} function. While
+ \samp{maxEmptyRect} will generally outperform \samp{emptyspace},
+ \samp{emptyspace} will sometimes find a slightly smaller, but
+ "squarer" rectangle.
+}
+\value{
+ The \samp{x} and \samp{y} coordinates of the center of the rectangle
+ found.
+}
+\author{Ray Brownrigg}
+\examples{
+ x<-rnorm(100)
+ y<-rnorm(100)
+ plot(x,y,main="Find the empty space",xlab="X",ylab="Y")
+ es<-emptyspace(x,y)
+ # use a transparent background so that any overplotted points are shown
+ boxed.labels(es,labels="Here is the\nempty space",bg="transparent")
+}
+\keyword{misc}
diff --git a/man/fan.plot.Rd b/man/fan.plot.Rd
new file mode 100755
index 0000000..a64b270
--- /dev/null
+++ b/man/fan.plot.Rd
@@ -0,0 +1,54 @@
+\name{fan.plot}
+\alias{fan.plot}
+\title{ Display a fan plot }
+\description{
+ Displays numerical values as the arcs of overlapping sectors.
+}
+\usage{
+ fan.plot(x,edges=200,radius=1,col=NULL,align.at=NULL,max.span=NULL,
+  labels=NULL,labelpos=NULL,label.radius=1.2,align="left",shrink=0.02,
+  main="",ticks=NULL,include.sumx=FALSE,...)
+}
+\arguments{
+ \item{x}{Vector of numbers.}
+ \item{edges}{The number of edges with which to draw a circle.}
+ \item{radius}{The radius of the sectors.}
+ \item{col}{The colors with which to fill the sectors.}
+ \item{align.at}{Where to align the sectors (see Details).}
+ \item{max.span}{The angle of the maximal sector in radians. The default
+  is to scale \samp{x} so that it sums to 2*pi.}
+ \item{labels}{Labels placed around the sector arcs.}
+ \item{labelpos}{Optional circumferential positions for the labels.}
+ \item{label.radius}{How far away from the sectors the labels will
+  be placed. May be a vector with a radius for each label.}
+ \item{align}{Position of the alignment of sectors (see Details).}
+ \item{shrink}{How much to shrink each successive sector in user units.}
+ \item{main}{Optional title for the plot.}
+ \item{ticks}{The number of ticks that would appear if the sectors were on
+  a pie chart. Default is no ticks, TRUE gives the number of ticks equal to
+  the integer sum of \samp{x}, which is fairly sensible if 
+  \samp{x} is a vector of integers.}
+ \item{include.sumx}{Whether to include the sum of all \samp{x} values
+  as the largest sector.}
+ \item{...}{Additional arguments passed to \samp{polygon}.}
+}
+\details{
+ \samp{fan.plot} displays sectors much like a pie chart except that the
+ sectors are overlapped. this allows the angular extents of the sectors to
+ be visually compared much more accurately by the viewer. Sectors are plotted
+ from the largest to the smallest, shrinking the radius of each successive
+ sector.
+}
+\value{
+ The circumferential positions of the labels in radians. These are
+ returned in order of decreasing size of the values plotted.
+}
+\author{Jim Lemon, Anupam Tyagi}
+\examples{
+ iucn.df<-data.frame(area=c("Africa","Asia","Europe","N&C America",
+  "S America","Oceania"),threatened=c(5994,7737,1987,4716,5097,2093))
+ fan.plot(iucn.df$threatened,max.span=pi,
+  labels=paste(iucn.df$area,iucn.df$threatened,sep="-"),
+  main="Threatened species by geographical area (fan.plot)",ticks=276)
+}
+\keyword{misc}
diff --git a/man/feather.plot.Rd b/man/feather.plot.Rd
new file mode 100755
index 0000000..451580c
--- /dev/null
+++ b/man/feather.plot.Rd
@@ -0,0 +1,54 @@
+\name{feather.plot}
+\alias{feather.plot}
+\title{ Display vectors along a horizontal reference line }
+\description{
+ Displays vectors along a line usually representing time or position.
+}
+\usage{
+ feather.plot(r,theta,xpos,yref=0,use.arrows=TRUE,
+ col.refline="lightgray",fp.type="s",main="",xlab="",ylab="",
+ xlabels=NULL,...)
+}
+\arguments{
+ \item{r}{radii of vectors}
+ \item{theta}{direction of vectors in radians}
+ \item{xpos}{where to start each vector along the reference line}
+ \item{yref}{vertical position to place the reference line}
+ \item{use.arrows}{whether to put arrow heads on the ends of the vectors}
+ \item{col.refline}{the color of the reference line}
+ \item{fp.type}{whether to use "standard" coordinates (begin at the
+  right and move counterclockwise) or "meteorological" coordinates
+  (begin at the top and move clockwise) when interpreting the values
+  of \samp{theta}}
+ \item{main}{the title of the plot}
+ \item{xlab}{the label for the reference line}
+ \item{ylab}{the label for the vertical axis}
+ \item{xlabels}{optional labels for the reference line}
+ \item{...}{additional arguments passed to \samp{arrows} or \samp{segments}}
+}
+\details{
+ This function places vectors of length \samp{r} and angle \samp{theta} 
+ along a reference line that may represent time or position or some other
+ value. The user is responsible for spacing the vectors so that they do
+ not overlap if this is desired.
+
+ Feather plots are typically wider than high. The user will probably want
+ to specify a graphics device that doesn't leave lots of blank space above
+ and below the plot.
+}
+\value{nil}
+\author{Jim Lemon, Eduardo Klein}
+\seealso{\link{spread.labels}}
+\examples{
+ dev.new(width=8,height=3)
+ r<-0.6+rnorm(24)/5
+ theta<-c(seq(15*pi/16,pi/16,length.out=12),
+  seq(17*pi/16,31*pi/16,length.out=12))
+ feather.plot(r,theta,xlabels=1:24,
+  main="Standard Coordinates",xlab="Time",ylab="Value")
+ # rearrange theta for meteorological coordinates
+ feather.plot(r,c(theta[19:24],rev(theta[7:18]),theta[1:6]),xlabels=1:24,fp.type="m",
+  main="Meteorological Coordinates",xlab="Time",ylab="Value")
+ dev.off()
+}
+\keyword{misc}
diff --git a/man/fill.corner.Rd b/man/fill.corner.Rd
new file mode 100644
index 0000000..be4e256
--- /dev/null
+++ b/man/fill.corner.Rd
@@ -0,0 +1,26 @@
+\name{fill.corner}
+\alias{fill.corner}
+\title{
+ Fill a "corner" of a matrix with values
+}
+\description{
+ Fills one corner of a matrix with the supplied values, leaving the rest
+ filled with a default value.
+}
+\usage{
+ fill.corner(x,nrow,ncol,na.value=NA)
+}
+\arguments{
+ \item{x}{A vector of values.}
+ \item{nrow,ncol}{The number of rows and columns in the matrix to be returned.}
+ \item{na.value}{The default value for unfilled cells.}
+}
+\details{
+ \samp{fill.corner} creates an nrow by ncol matrix and fills the lower left
+ corner with the values supplied in \samp{x}. If there are more values in
+ \samp{x} than cells in the matrix, only the first nrow*ncol values will be
+ inserted.
+}
+\value{An nrow by ncol matrix containing the values in \samp{x}.}
+\author{Jim Lemon}
+\keyword{misc}
diff --git a/man/floating.pie.Rd b/man/floating.pie.Rd
new file mode 100755
index 0000000..639753a
--- /dev/null
+++ b/man/floating.pie.Rd
@@ -0,0 +1,60 @@
+\name{floating.pie}
+\alias{floating.pie}
+\title{Display a floating pie chart}
+\description{
+ Displays a pie chart at an arbitrary position on an existing plot
+}
+\usage{
+ floating.pie(xpos,ypos,x,edges=200,radius=1,col=NULL,startpos=0,
+  shadow=FALSE,shadow.col=c("#ffffff","#cccccc"),...)
+}
+\arguments{
+ \item{xpos,ypos}{x and y position of the center of the pie chart}
+ \item{x}{a numeric vector for which each value will be a sector}
+ \item{edges}{the number of lines forming a circle}
+ \item{radius}{the radius of the pie in user units}
+ \item{col}{the colors of the sectors - defaults to \samp{rainbow}}
+ \item{startpos}{The starting position for drawing sectors in radians.}
+ \item{shadow}{Logical - whether to draw a shadow}
+ \item{shadow.col}{Colors to use for a shadow.}
+ \item{...}{graphical parameters passed to \samp{polygon}}
+}
+\details{
+ \samp{floating.pie} displays a pie chart with an optional shadow on an
+ existing plot (see \samp{polygon.shadow}). \samp{floating.pie} now accepts
+ NAs or zeros in \samp{x}, but simply ignores them.
+
+ \samp{floating.pie} can be useful when multiple pie charts are placed on a
+ plot overlaying something else, like a map.
+}
+\value{
+ The bisecting angle of the sectors in radians. Useful for placing
+ text labels for each sector. If any values in \samp{x} were zero or NA,
+ no angle is returned for that value. This means that the user must adjust
+ the labels accordingly if \samp{pie.labels} is called.
+}
+\note{
+ As with most pie charts, simplicity is essential. Trying to display a
+ complicated breakdown of data rarely succeeds.
+}
+\author{Jim Lemon}
+\seealso{\link{pie.labels}, \link{boxed.labels}, \link{polygon.shadow}}
+\examples{
+ plot(1:5,type="n",main="Floating Pie test",xlab="",ylab="",axes=FALSE)
+ box()
+ polygon(c(0,0,5.5,5.5),c(0,3,3,0),border="#44aaff",col="#44aaff")
+ floating.pie(1.7,3,c(2,4,4,2,8),radius=0.5,
+  col=c("#ff0000","#80ff00","#00ffff","#44bbff","#8000ff"))
+ floating.pie(3.1,3,c(1,4,5,2,8),radius=0.5,
+  col=c("#ff0000","#80ff00","#00ffff","#44bbff","#8000ff"))
+ floating.pie(4,1.5,c(3,4,6,7),radius=0.5,
+  col=c("#ff0066","#00cc88","#44bbff","#8000ff"))
+ draw.circle(3.9,2.1,radius=0.04,col="white")
+ draw.circle(3.9,2.1,radius=0.04,col="white")
+ draw.circle(3.9,2.1,radius=0.04,col="white")
+ draw.circle(4,2.3,radius=0.04,col="white")
+ draw.circle(4.07,2.55,radius=0.04,col="white")
+ draw.circle(4.03,2.85,radius=0.04,col="white")
+ text(c(1.7,3.1,4),c(3.7,3.7,3.7),c("Pass","Pass","Fail"))
+}
+\keyword{misc}
diff --git a/man/fullaxis.Rd b/man/fullaxis.Rd
new file mode 100755
index 0000000..8b8aab4
--- /dev/null
+++ b/man/fullaxis.Rd
@@ -0,0 +1,51 @@
+\name{fullaxis}
+\alias{fullaxis}
+\title{Add an axis with a line to the edge of the plot}
+\description{
+  As \samp{axis}, but draws a "box" line in the same color as the axis.
+}
+\usage{
+ fullaxis(side=1,at=NULL,labels=TRUE,line=NA,pos=NA,outer=FALSE,
+ font=NA,lty="solid",lwd=1,lwd.ticks=lwd,col=NULL,col.ticks=NULL,
+ hadj=NA,padj=NA,...)
+}
+\arguments{
+ \item{side}{The side of the plot to draw the axis}
+ \item{at}{Optional positions in user units for the tick marks.}
+ \item{labels}{Optional labels for the tick marks.}
+ \item{line}{Optional line into the margin.}
+ \item{pos}{Optional position in user units for the axis. Defaults to the edge.}
+ \item{outer}{Whether to use the outer margin as for \samp{axis}.}
+ \item{font}{Font for the labels.}
+ \item{lty}{Line type.}
+ \item{lwd}{Line width for the axis.}
+ \item{lwd.ticks}{Line width for the ticks.}
+ \item{col}{color for the axis and tick marks. See Details for label color.}
+ \item{col.ticks}{Color for the tick marks if different from the axis.}
+ \item{hadj,padj}{Justification for the labels. See \samp{axis}.}
+ \item{...}{Further arguments passed to \samp{axis}.}
+}
+\details{
+ \samp{fullaxis} draws a line to the edges of the plot and then calls
+ \samp{axis} to draw an axis. \samp{fullaxis} is mainly useful for drawing a
+ colored axis on a boxed plot. In order to get the tick labels the same color as
+ the axis and ticks, pass the \samp{col.axis} argument (as part of ...) as well
+ as \samp{col}. See the example for some useful tips.
+}
+\value{
+ The positions of the tick marks in user units.
+}
+\author{ Jim Lemon }
+\seealso{ \link{axis}}
+\examples{
+ plot(runif(20,-1,1),runif(20,-1,1),xlim=c(-1,1.5),main="Demo of fullaxis",
+  xlab="X",ylab="Y",axes=FALSE)
+ fullaxis(1,col="red",col.axis="red")
+ fullaxis(2,col="blue",col.axis="blue")
+ fullaxis(4,at=c(-0.5,0,0.5),labels=c("Negative","Zero","Positive"),pos=1.2,
+  col="green",las=1)
+ # add a top line to complete the "box"
+ xylim<-par("usr")
+ segments(xylim[1],xylim[4],xylim[2],xylim[4])
+}
+\keyword{misc}
diff --git a/man/furc.Rd b/man/furc.Rd
new file mode 100755
index 0000000..ddbb406
--- /dev/null
+++ b/man/furc.Rd
@@ -0,0 +1,36 @@
+\name{furc}
+\alias{furc}
+\title{Plot a dendrite}
+\description{Plot one level of a dendrogram displaying two or more mutually 
+ exclusive attributes.}
+\usage{
+ furc(x,xpos,yrange,toplevel,maxx,cex=1,col)
+}
+\arguments{
+ \item{x}{A \samp{dendrite} object containing the counts of objects having
+  combinations of mutually exclusive attributes.}
+ \item{xpos}{The horizontal position on the plot to display the current level
+  of the dendrogram.}
+ \item{yrange}{The range of values in which the current level of the dendrogram
+  will be displayed.}
+ \item{toplevel}{A flag for the function to know whether it is at the top level
+  of the dendrogram or not. Do not change this argument.}
+ \item{maxx}{The maximum xpos value to suppress staggering of the category
+  labels. This is calculated in \samp{plot.dendrite}.}
+ \item{cex}{The character expansion to use in the display.}
+ \item{col}{The color(s) to use for the backgrounds of the boxes containing
+  the category labels.}
+}
+\details{  
+ \samp{furc} displays one \emph{furc}ation of the dendrogram. A furcation is
+ a single box displaying its label and count that may split into finer
+ divisions. If so, \samp{furc} calls itself for each furcation until there
+ are no more splits.
+ 
+ On the final level of categorization, the category labels are staggered 
+ to minimize overprinting.
+}
+\value{nil}
+\keyword{misc}
+\author{Jim Lemon}
+\seealso{\link{plot.dendrite}}
diff --git a/man/gantt.chart.Rd b/man/gantt.chart.Rd
new file mode 100755
index 0000000..3599519
--- /dev/null
+++ b/man/gantt.chart.Rd
@@ -0,0 +1,103 @@
+\encoding{latin1}
+\name{gantt.chart}
+\alias{gantt.chart}
+\title{Display a Gantt chart}
+\description{
+ Displays a Gantt chart with priority coloring
+}
+\usage{
+ gantt.chart(x=NULL,format="\%Y/\%m/\%d",xlim=NULL,taskcolors=NULL,
+  priority.legend=FALSE,vgridpos=NULL,vgridlab=NULL,
+  vgrid.format="\%Y/\%m/\%d",
+  half.height=0.25,hgrid=FALSE,main="",xlab="",cylindrical=FALSE,
+  label.cex=1,border.col=NA,priority.label="Priorities",
+  priority.extremes=c("High","Low"),time.axis=3)
+}
+\arguments{
+ \item{x}{a list of task labels, start/end times and task priorities
+  as returned by \samp{get.gantt.info}. If this is not present,
+  \link{get.gantt.info} will be called.}
+ \item{format}{the format to be used in entering dates/times
+  (see \link{strptime}).}
+ \item{xlim}{the horizontal limits of the plot.}
+ \item{taskcolors}{a vector of colors used to illustrate task priority.}
+ \item{priority.legend}{Whether to display a priority color legend.}
+ \item{vgridpos}{optional positions of the vertical grid lines.}
+ \item{vgridlab}{optional labels for the vertical grid lines.}
+ \item{vgrid.format}{format for the vertical grid labels.}
+ \item{half.height}{the proportion of the spacing between task bars that
+  will be filled by the bar on each side - 0.5 will leave no space.}
+ \item{hgrid}{logical - whether to display grid lines between the bars.}
+ \item{main}{the title of the plot - note that this is actually displayed
+  using \samp{mtext}.}
+ \item{xlab}{horizontal axis label - usually suppressed.}
+ \item{cylindrical}{Whether to give the bars a cylindrical appearance.}
+ \item{label.cex}{Relative size for the task labels at the left side.}
+ \item{border.col}{The color for an optional border for the bars (NA=none).}
+ \item{priority.label}{Label for the priority color legend.}
+ \item{priority.extremes}{Labels for each end of the priority color legend.}
+ \item{time.axis}{Where to place the time axis labels.}
+}
+\value{
+ The list used to create the chart - see \link{get.gantt.info} for
+ details. This can be saved and reused rather than manually entering the 
+ information each time the chart is displayed.
+}
+\details{
+ If task priority colors are not wanted, set \samp{taskcolors} to a single
+ value to suppress the coloring. If this is not done, \samp{rainbow} will
+ be called to generate a different color for each task. If colors other than
+ \samp{rainbow} are wanted, remember to pass enough colors for one to the
+ lowest (highest numerically) priority.
+ 
+ There can now be more than one time interval for each task. If there is,
+ more than one bar will be displayed for each interval, which may not be a
+ task at all, but rather intervals related to the labels. Colors can be
+ specified for labels or intervals and if there are not as many colors as
+ intervals, the first "number of unique labels" colors will be assigned to
+ each unique label. This should make every bar for each label the
+ same color, but be aware that the colors will be distributed in alphabetical
+ order of the entity labels. If there are at least as many taskcolors as intervals,
+ they will be assigned to intervals in the order of the \samp{taskcolors} vector.
+ The examples should make this clearer.
+
+ Since \samp{gantt.chart} can be used to display things other than prioritized
+ tasks, the labels for the priority legend can now be specified.
+}
+\author{Jim Lemon (original by Scott Waichler - features by Ulrike Gromping -
+ added label colors by Nicolas Immelman)}
+\seealso{\link{get.gantt.info}}
+\examples{
+ Ymd.format<-"\%Y/\%m/\%d"
+ gantt.info<-list(labels=
+  c("First task","Second task","Third task","Fourth task","Fifth task"),
+  starts=
+  as.POSIXct(strptime(
+  c("2004/01/01","2004/02/02","2004/03/03","2004/05/05","2004/09/09"),
+  format=Ymd.format)),
+  ends=
+  as.POSIXct(strptime(
+  c("2004/03/03","2004/05/05","2004/05/05","2004/08/08","2004/12/12"),
+  format=Ymd.format)),
+  priorities=c(1,2,3,4,5))
+ vgridpos<-as.POSIXct(strptime(c("2004/01/01","2004/02/01","2004/03/01",
+  "2004/04/01","2004/05/01","2004/06/01","2004/07/01","2004/08/01",
+  "2004/09/01","2004/10/01","2004/11/01","2004/12/01"),format=Ymd.format))
+ vgridlab<-
+  c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
+ gantt.chart(gantt.info,main="Calendar date Gantt chart (2004)",
+  priority.legend=TRUE,vgridpos=vgridpos,vgridlab=vgridlab,hgrid=TRUE)
+ # if both vgidpos and vgridlab are specified,
+ # starts and ends don't have to be dates
+ info2<-list(labels=c("Jim","Joe","Jim","John","John","Jake","Joe","Jed","Jake"),
+  starts=c(8.1,8.7,13.0,9.1,11.6,9.0,13.6,9.3,14.2),
+  ends=c(12.5,12.7,16.5,10.3,15.6,11.7,18.1,18.2,19.0))
+ gantt.chart(info2,vgridlab=8:19,vgridpos=8:19,
+  main="All bars the same color",taskcolors="lightgray")
+ gantt.chart(info2,vgridlab=8:19,vgridpos=8:19,
+  main="A color for each label",taskcolors=c(2,3,7,4,8))
+ gantt.chart(info2,vgridlab=8:19,vgridpos=8:19,
+  main="A color for each interval - with borders",
+  taskcolors=c(2,3,7,4,8,5,3,6,"purple"),border.col="black")
+}
+\keyword{misc}
diff --git a/man/gap.barplot.Rd b/man/gap.barplot.Rd
new file mode 100755
index 0000000..3902147
--- /dev/null
+++ b/man/gap.barplot.Rd
@@ -0,0 +1,50 @@
+\name{gap.barplot}
+\alias{gap.barplot}
+\title{
+ Display a barplot with a gap (missing range) on one axis
+}
+\description{
+ Displays a barplot with a missing range.
+}
+\usage{
+ gap.barplot(y,gap,xaxlab,xtics,yaxlab,ytics,xlim=NA,ylim=NA,xlab=NULL,
+  ylab=NULL,horiz=FALSE,col,...)
+}
+\arguments{
+ \item{y}{a vector of data values}
+ \item{gap}{the range of values to be left out}
+ \item{xaxlab}{labels for the x axis ticks}
+ \item{xtics}{position of the x axis ticks}
+ \item{yaxlab}{labels for the y axis ticks}
+ \item{ytics}{position of the y axis ticks}
+ \item{xlim}{Optional x limits for the plot}
+ \item{ylim}{optional y limits for the plot}
+ \item{xlab}{label for the x axis}
+ \item{ylab}{label for the y axis}
+ \item{horiz}{whether to have vertical or horizontal bars}
+ \item{col}{color(s) in which to plot the values}
+ \item{...}{arguments passed to \samp{barplot}.}
+}
+\value{
+ The center positions of the bars.
+}
+\details{
+ Displays a barplot omitting a range of values on the X or Y axis. Typically 
+ used when there is a relatively large gap in the range of values 
+ represented as bar heights. See \link{axis.break} for a brief 
+ discussion of plotting on discontinuous coordinates.
+ 
+ If the user does not ask for specific y limits, the function will calculate
+ limits based on the range of the data values. If passing specific limits, 
+ remember to subtract the gap from the upper limit.
+}
+\author{Jim Lemon}
+\seealso{\link{gap.barplot}}
+\examples{
+ twogrp<-c(rnorm(10)+4,rnorm(10)+20)
+ gap.barplot(twogrp,gap=c(8,16),xlab="Index",ytics=c(3,6,17,20),
+  ylab="Group values",main="Barplot with gap")
+ gap.barplot(twogrp,gap=c(8,16),xlab="Index",ytics=c(3,6,17,20),
+  ylab="Group values",horiz=TRUE,main="Horizontal barplot with gap")
+}
+\keyword{misc}
diff --git a/man/gap.boxplot.Rd b/man/gap.boxplot.Rd
new file mode 100755
index 0000000..a0ff099
--- /dev/null
+++ b/man/gap.boxplot.Rd
@@ -0,0 +1,78 @@
+\name{gap.boxplot}
+\alias{gap.boxplot}
+\title{Display a boxplot with a gap (missing range)}
+\description{
+ Displays a boxplot with a missing range.
+}
+\usage{
+ gap.boxplot(x,...,gap=list(top=c(NA,NA),bottom=c(NA,NA)),
+ range=1.5,width=NULL,varwidth=FALSE,notch=FALSE,outline=TRUE,
+ names,xlim=NA,ylim=NA,plot=TRUE,border=par("fg"),col=NULL,log="",
+ axis.labels=NULL,axes=TRUE,pars=list(boxwex=0.8,staplewex=0.5,outwex=0.5),
+ horizontal=FALSE,add=FALSE,at=NULL,main=NULL)
+}
+\arguments{
+ \item{x}{numeric vector or a list of vectors}
+ \item{...}{arguments passed to \link{boxplot}.}
+ \item{gap}{the range(s) to be omitted - a list with two components,
+  \samp{top} and \samp{bottom} each specifying a range to omit. The
+  default range of \samp{c(NA,NA)} means no omitted range}
+ \item{range}{how far to extend the whiskers, (see \link{boxplot})}
+ \item{width}{the relative widths of the boxes}
+ \item{varwidth}{if TRUE, box widths are proportional to the square roots
+  of the number of observations}
+ \item{notch}{whether to display the confidence intervals for the
+  median as notches}
+ \item{outline}{whether to display outliers}
+ \item{names}{optional names to display beneath each boxplot}
+ \item{xlim,ylim}{Optional x and y axis limits for the plot.}
+ \item{boxwex}{scale factor for box widths}
+ \item{staplewex}{staple width proportional to box width}
+ \item{outwex}{outlier line width}
+ \item{plot}{dummy argument for consistency with \samp{boxplot} - always
+  plots}
+ \item{border}{optional color(s) for the box lines}
+ \item{col}{optional color(s) to fill the boxes}
+ \item{log}{whether to use a log scale - currently does nothing}
+ \item{axis.labels}{Optional axis labels.}
+ \item{axes}{Whether to display axes.}
+ \item{pars}{optional parameters for consistency with \samp{boxplot}}
+ \item{horizontal}{whether to plot horizontal boxplots - currently
+  does nothing}
+ \item{add}{whether to add the boxplot(s) to a current plot - currently
+  does nothing.}
+ \item{at}{optional horizontal locations for the boxplots.}
+ \item{main}{a title for the plot.}
+}
+\value{
+ A list with the same structure as returned by \samp{boxplot}, except that
+ the values of elements beyond the gap(s) have their true positions on the
+ plot rather than the original values. For example, in the second example,
+ the value returned for the upper staple of the right boxplot is 14 rather
+ than 20, due to the 6 unit gap.
+}
+\details{
+ Displays boxplot(s) omitting range(s) of values on the top and/or bottom
+ of the plot. Typically used when there are outliers far from the boxes.
+ See \link{boxplot} for more detailed descriptions of the
+ arguments. If the gaps specified include any of the values in the \samp{stats}
+ matrix returned from \samp{boxplot}, the function will exit with an
+ error message. This prevents generation of NAs in indexing operations,
+ which would fail anyway. A gap can include part of a box, but it is unlikely 
+ that this would be intended by the user.
+ 
+ See \link{axis.break} for a brief discussion 
+ of plotting on discontinuous coordinates.
+}
+\author{Jim Lemon}
+\seealso{\link{gap.barplot},\link{gap.plot}}
+\examples{
+ twovec<-list(vec1=c(rnorm(30),-6),vec2=c(sample(1:10,40,TRUE),20))
+ gap.boxplot(twovec,gap=list(top=c(12,18),bottom=c(-5,-3)),
+ main="Show outliers separately")
+ if(dev.interactive()) par(ask=TRUE)
+ gap.boxplot(twovec,gap=list(top=c(12,18),bottom=c(-5,-3)),range=0,
+ main="Include outliers in whiskers")
+ par(ask=FALSE)
+}
+\keyword{misc}
diff --git a/man/gap.plot.Rd b/man/gap.plot.Rd
new file mode 100755
index 0000000..679307a
--- /dev/null
+++ b/man/gap.plot.Rd
@@ -0,0 +1,87 @@
+\name{gap.plot}
+\alias{gap.plot}
+\title{Display a plot with one or two gaps (missing ranges) on one axis}
+\description{
+ Displays a plot with one or two missing ranges on one of the axes.
+}
+\usage{
+ gap.plot(x,y,gap,gap.axis="y",bgcol="white",breakcol="black",brw=0.02,
+  xlim=range(x),ylim=range(y),xticlab,xtics=NA,yticlab,ytics=NA,
+  lty=rep(1,length(x)),col=rep(par("col"),length(x)),pch=rep(1,length(x)),
+  add=FALSE,stax=FALSE,...)
+}
+\arguments{
+ \item{x,y}{data values}
+ \item{gap}{the range(s) of values to be left out}
+ \item{gap.axis}{whether the gaps are to be on the x or y axis}
+ \item{bgcol}{the color of the plot background}
+ \item{breakcol}{the color of the "break" marker}
+ \item{brw}{break width relative to plot width}
+ \item{xlim,ylim}{the plot limits.}
+ \item{xticlab}{labels for the x axis ticks}
+ \item{xtics}{position of the x axis ticks}
+ \item{yticlab}{labels for the y axis ticks}
+ \item{ytics}{position of the y axis ticks}
+ \item{lty}{line type(s) to use if there are lines}
+ \item{col}{color(s) in which to plot the values}
+ \item{pch}{symbols to use in plotting.}
+ \item{add}{whether to add values to an existing plot.}
+ \item{stax}{whether to call staxlab for staggered axis labels.}
+ \item{...}{arguments passed to \samp{plot} and \samp{points}.}
+}
+\value{nil}
+\details{
+ Displays a plot omitting one or two ranges of values on one axis. 
+ Typically used when there is a relatively large gap or two in the overall 
+ range of one set of values, often because of outliers. The function warns
+ the user if any values may have been omitted by being in the "gap". See 
+ \link{axis.break} for a brief discussion of plotting on 
+ discontinuous coordinates.
+ 
+ To add more data series to a gap plot, call \samp{gap.plot} with
+ \samp{add = TRUE}. The same \samp{gap} and \samp{gap.axis} arguments as
+ in the initial call must be passed or the data will not be displayed
+ correctly. Remember to pass an explicit \samp{xlim} or \samp{ylim} to
+ the initial call if the added data exceed the range of the data
+ initially displayed. Also remember to subtract the width(s) of the gap(s)
+ if you are passing an explicit \samp{xlim} or \samp{ylim}.
+ 
+ Because the gaps take up some space, it is possible to have a data value
+ that is just below a gap plotted in the gap. The answer is to make the lower
+ gap limit a little higher if this is a problem.
+ 
+ If at least four values are passed in \samp{gap}, the first four will be
+ used to calculate two "gaps" in the plot instead of one. The function does
+ not check whether these values are sensible, so it is quite easy to
+ ask for a very silly plot.
+ 
+ The default ticks are usually not ideal, and most users will want to pass
+ their own tick positions and perhaps labels. Note that \samp{lines} appears
+ to use only the first \samp{col} and \samp{lty} argument value, so if you
+ must have lines with different colors and types, use \samp{add=TRUE} and add
+ them separately (see the third example for the problem and the solution).
+}
+\author{Jim Lemon and Ben Bolker (thanks to Zheng Lu for the "add" idea,
+ and Art Roberts for helping to get the gaps right.)}
+\seealso{\link{gap.barplot}, \link{axis.break}, \link{do.first}}
+\examples{
+ twogrp<-c(rnorm(5)+4,rnorm(5)+20,rnorm(5)+5,rnorm(5)+22)
+ gpcol<-c(2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5)
+ gap.plot(twogrp,gap=c(8,16),xlab="Index",ylab="Group values",
+  main="Gap on Y axis",col=gpcol)
+ gap.plot(twogrp,rnorm(20),gap=c(8,16),gap.axis="x",xlab="X values",
+  xtics=c(4,7,17,20),ylab="Y values",main="Gap on X axis with added lines")
+ gap.plot(c(seq(3.5,7.5,by=0.5),seq(16.5,22.5,by=0.5)),
+  rnorm(22),gap=c(8,16),gap.axis="x",type="l",add=TRUE,col=2,)
+ gap.plot(twogrp,gap=c(8,16,25,35),
+ xlab="X values",ylab="Y values",xlim=c(1,30),ylim=c(0,42),
+ main="Test two gap plot with the lot",xtics=seq(0,30,by=5),
+ ytics=c(4,6,18,20,22,38,40,42),
+ lty=c(rep(1,10),rep(2,10)),
+ pch=c(rep(2,10),rep(3,10)),
+ col=c(rep(2,10),rep(3,10)),
+ type="b")
+ gap.plot(21:30,rnorm(10)+40,gap=c(8,16,25,35),add=TRUE,
+  lty=rep(3,10),col=rep(4,10),type="l")
+}
+\keyword{misc}
diff --git a/man/get.breaks.Rd b/man/get.breaks.Rd
new file mode 100755
index 0000000..b436def
--- /dev/null
+++ b/man/get.breaks.Rd
@@ -0,0 +1,23 @@
+\name{get.breaks}
+\alias{get.breaks}
+\title{Get the breakpoints for a weighted histogram}
+\description{
+ Gets the breakpoints for a weighted histogram.
+}
+\usage{
+ get.breaks(x,breaks)
+}
+\arguments{
+  \item{x}{A numeric vector.}
+  \item{breaks}{Either the name of the function to calculate breakpoints, the
+  number of categories or a vector of breakpoints.}
+}
+\details{
+ \samp{get.breaks} either calls the same functions as \samp{hist} to get
+  breakpoints or calculates a given number or just returns \samp{breaks}
+  if they are already specified.
+}
+\value{A vector of breakpoints.}
+\author{Jim Lemon}
+\seealso{\link{hist}}
+\keyword{misc}
diff --git a/man/get.gantt.info.Rd b/man/get.gantt.info.Rd
new file mode 100755
index 0000000..c1efe0a
--- /dev/null
+++ b/man/get.gantt.info.Rd
@@ -0,0 +1,29 @@
+\name{get.gantt.info}
+\alias{get.gantt.info}
+\title{Gather the information to create a Gantt chart}
+\description{
+ Allows the user to enter the information for a Gantt chart.
+}
+\usage{
+ get.gantt.info(format="\%Y/\%m/\%d")
+}
+\arguments{
+ \item{format}{the format to be used in entering dates/times. Defaults to
+  YYYY/mm/dd. See \link{strptime} for various date/time formats.}
+}
+\value{
+ The list used to create the chart. Elements are:
+ \item{labels}{The task labels to be displayed at the left of the chart.}
+ \item{starts,ends}{The task starts/ends as POSIXct dates/times.}
+ \item{priorities}{Task priorities as integers in the range 1 to 10.
+  There can be less than 10 levels of priority, but if priorities do
+  not start at 1 (assumed to be the highest), the default priority colors
+  will be calculated from 1.}
+}
+\author{Jim Lemon}
+\seealso{\link{gantt.chart}}
+\examples{
+ cat("Enter task times using HH:MM (hour:minute) format\n")
+ get.gantt.info("\%H:\%M")
+}
+\keyword{misc}
diff --git a/man/get.segs.Rd b/man/get.segs.Rd
new file mode 100755
index 0000000..771f246
--- /dev/null
+++ b/man/get.segs.Rd
@@ -0,0 +1,29 @@
+\name{get.segs}
+\alias{get.segs}
+\title{Calculate the midpoints and limits for a centipede plot}
+\description{
+ Calculates midpoints and limits for a list or data frame for use with
+  centipede.plot.
+}
+\usage{
+ get.segs(x,mct="mean",lower.limit="std.error",upper.limit=lower.limit)
+}
+\arguments{
+  \item{x}{a list or data frame.}
+  \item{mct}{The name of the function to calculate midpoints.}
+  \item{lower.limit,upper.limit}{The names of the function(s) to calculate 
+   lower and upper limits.}
+}
+\details{
+ \samp{get.segs} calls the functions whose names are passed to calculate
+  midpoints and limits for each list element or data frame column. The
+  user can define special functions for the central and dispersion measures
+  if desired.
+}
+\value{A matrix with four rows and as many columns as were in the object
+ \samp{x}. The first row contains the midpoint values, the second and third
+ the lower and upper limit values respectively and the fourth row the number
+ of valid observations in the columns.}
+\author{Jim Lemon}
+\seealso{\link{centipede.plot}}
+\keyword{misc}
diff --git a/man/get.soil.texture.Rd b/man/get.soil.texture.Rd
new file mode 100755
index 0000000..7589a64
--- /dev/null
+++ b/man/get.soil.texture.Rd
@@ -0,0 +1,29 @@
+\name{get.soil.texture}
+\alias{get.soil.texture}
+\title{Enter soil texture data}
+\usage{
+ get.soil.texture(use.percentages=FALSE,cnames=c("sand","silt","clay"))
+}
+\arguments{
+ \item{use.percentages}{Logical - whether to treat the entries as
+  percentages and scale to proportions.}
+ \item{cnames}{column names for the resulting three column matrix.}
+}
+\description{
+ \samp{get.soil.texture} calls \samp{get.triprop} to allow the user to 
+ enter soil textures as the proportions or percentages of three 
+ components, sand, silt and clay.
+}
+\value{A matrix of the components of one or more soil samples.}
+\author{Sander Oom and Jim Lemon}
+\seealso{\link{soil.texture},\link{get.triprop}}
+\examples{
+ if(dev.interactive()) {
+  newsp<-get.soil.texture()
+  # show the soil triangle
+  soil.texture()
+  # now plot the observations
+  show.soil.texture(newsp)
+ }
+}
+\keyword{misc}
diff --git a/man/get.tablepos.Rd b/man/get.tablepos.Rd
new file mode 100644
index 0000000..acada57
--- /dev/null
+++ b/man/get.tablepos.Rd
@@ -0,0 +1,31 @@
+\name{get.tablepos}
+\alias{get.tablepos}
+\title{Get the position for a legend or table}
+\description{
+ Gets the x and y positions and justification for a legend or table in
+ user units from the string descriptors like "top".
+}
+\usage{
+ get.tablepos(x)
+}
+\arguments{
+  \item{x}{A valid position descriptor like "top".}
+}
+\details{
+ \samp{get.tablepos} checks for one of the nine valid position descriptors:
+
+ topleft, top, topright, left, center, right, bottomleft, bottom and bottomright.
+
+ If none of these descriptors are found, it will return the center position
+ and justification.
+}
+\value{
+ A list containing:
+ \item{x}{x position}
+ \item{y}{y position}
+ \item{xjust}{x (horizontal) justification}
+ \item{yjust}{y (vertical) justification}
+}
+\author{Jim Lemon}
+\seealso{\link{addtable2plot}, \link{legendg}}
+\keyword{misc}
diff --git a/man/get.triprop.Rd b/man/get.triprop.Rd
new file mode 100755
index 0000000..a15b03d
--- /dev/null
+++ b/man/get.triprop.Rd
@@ -0,0 +1,32 @@
+\name{get.triprop}
+\alias{get.triprop}
+\title{Enter three proportion data - usually soil textures}
+\usage{
+ get.triprop(use.percentages=FALSE,cnames=c("1st","2nd","3rd"))
+}
+\arguments{
+ \item{use.percentages}{Logical - whether to treat the entries as
+  percentages and scale to proportions.}
+ \item{cnames}{column names for the resulting three column matrix.}
+}
+\description{
+ \samp{get.triprop} allows the user to enter triplets of proportions
+ or percentages of three components such as sand, silt and clay in soils.
+}
+\details{
+ The three proportions of each row must sum to 100 or 1 within 1\% or
+ the function will warn the operator.}
+\value{A matrix of the components of one or more observations.}
+\author{Jim Lemon}
+\seealso{\link{triax.plot}, \link{soil.texture}}
+\examples{
+ if(dev.interactive()) {
+  # get some proportions
+  newsp<-get.triprop()
+  # show the triangle
+  triax.frame(main="Test triax.plot")
+  # now plot the observations
+  triax.points(newsp)
+ }
+}
+\keyword{misc}
diff --git a/man/getFigCtr.Rd b/man/getFigCtr.Rd
new file mode 100755
index 0000000..b86d90e
--- /dev/null
+++ b/man/getFigCtr.Rd
@@ -0,0 +1,26 @@
+\name{getFigCtr}
+\title{Get coordinates in the figure region in user units.}
+\description{
+ Calculates the coordinates of a proportional point of the figure
+ region in user units.}
+\usage{
+ getFigCtr(pos=c(0.5,0.5))
+}
+\arguments{
+ \item{pos}{The proportion of the figure region to find (see Details).}
+}
+\alias{getFigCtr}
+\details{
+ \samp{getFigCtr} reads parameters about the current plot and calculates the
+ vertical and horizontal centers of the figure region by default. This is 
+ typically useful for placing a centered title on plots where the left and
+ right margins are very different.
+
+ By changing \samp{pos}, any proportional points of the figure region can be
+ returned. For example, \samp{pos=c(0,0)} will return the left and bottom
+ coordinates of the figure region.
+}
+\value{A two element vector containing the coordinates of the center of the
+ figure region in user units.}
+\author{Jim Lemon (thanks to Karl Brand for the adjustable coordinates)}
+\keyword{misc}
diff --git a/man/getIntersectList.Rd b/man/getIntersectList.Rd
new file mode 100755
index 0000000..b4f6bb9
--- /dev/null
+++ b/man/getIntersectList.Rd
@@ -0,0 +1,51 @@
+\name{getIntersectList}
+\alias{getIntersectList}
+\title{Enter a set intersection list}
+\description{Enter the information for a set intersection display.}
+\usage{
+ getIntersectList(nelem,xnames=NULL,sep="+")
+}
+\arguments{
+ \item{nelem}{The number of sets for which the intersections will be displayed.}
+ \item{xnames}{The labels for the set intersections. The function creates names
+  from combinations of the first \samp{nelem} capital letters if none are 
+  given.}
+ \item{sep}{The separator to use when calling \samp{paste}.}
+}
+\details{
+ \samp{getIntersectList} allows the user to manually enter the counts of
+ set intersections rather than build this information from a matrix of data.
+ It is probably most useful for producing an intersection diagram when the
+ counts of the intersections are already known, or when the values are
+ proportions rather than counts as in the example.
+
+ It is very helpful when there are large numbers of elements, as the
+ \samp{makeIntersectList} function runs very slowly.
+}
+\value{A list of the counts of elements in the set intersections.}
+\author{Jim Lemon}
+\seealso{\link{makeIntersectList}, \link{intersectDiagram}}
+\examples{
+ # this example is from a haplotype mapping problem submitted by Mao Jianfeng
+ \dontrun{
+ hapIntList<-
+  getIntersectList(3,xnames=c("hap.Pd","hap.Pt","hap.Py"))
+ # enter the data as follows:
+ # Number of elements in hap.Pd - 1: 27.586
+ # Number of elements in hap.Pt - 1: 20.689
+ # Number of elements in hap.Py - 1: 31.035
+ # Number of elements in hap.Pd-hap.Pt - 1: 10.345
+ # Number of elements in hap.Pd-hap.Py - 1: 10.345
+ # Number of elements in hap.Pt-hap.Py - 1: 0
+ # Number of elements in hap.Pd-hap.Pt-hap.Py - 1: 0
+ # Total number of elements - 1: 100
+ }
+ hapIntList<-structure(list(structure(c(27.586, 20.689, 31.035),
+  .Names = c("hap.Pd","hap.Pt","hap.Py")),
+  structure(c(10.345, 10.345, 0),
+  .Names = c("hap.Pd-hap.Pt","hap.Pd-hap.Py","hap.Pt-hap.Py")),
+  structure(0, .Names = "hap.Pd-hap.Pt-hap.Py"),100),
+  class = "intersectList")
+ intersectDiagram(hapIntList)
+}
+\keyword{misc}
diff --git a/man/getMarginWidth.Rd b/man/getMarginWidth.Rd
new file mode 100755
index 0000000..b830357
--- /dev/null
+++ b/man/getMarginWidth.Rd
@@ -0,0 +1,36 @@
+\name{getMarginWidth}
+\alias{getMarginWidth}
+\title{Find the margin width necessary to fit text or a legend next to a plot}
+\description{
+ Calculates the margin width necessary to fit text or a legend next to a plot.
+}
+\usage{
+ getMarginWidth(side=4,labels,is.legend=FALSE)
+}
+\arguments{
+ \item{side}{Which side of the plot (as in axis).}
+ \item{labels}{The text to place next to the plot.}
+ \item{is.legend}{Whether the text is in a legend or not.}
+}
+\details{
+ \samp{getMarginWidth} reads parameters about the current plot and calculates the
+ left or right (default) margin necessary to fit the strings passed as 
+ \samp{labels} or a legend containing those strings.
+}
+\value{
+ A two element list containing the number of margin lines necessary to
+ fit the text or legend and the horizontal center of the margin in user units.
+}
+\author{Jim Lemon}
+\examples{
+ plot(rnorm(10))
+ newmarinfo<-getMarginWidth(labels=c("Long label","Even longer label"))
+ oldmar<-par("mar")
+ par(mar=c(oldmar[1:3],newmarinfo$newmar))
+ plot(rnorm(10))
+ par(xpd=TRUE)
+ text(rep(newmarinfo$marcenter,2),c(0.5,-0.5),
+  c("Long label","Even longer label"))
+ par(mar=oldmar,xpd=FALSE)
+}
+\keyword{misc}
diff --git a/man/getYmult.Rd b/man/getYmult.Rd
new file mode 100644
index 0000000..dcb12da
--- /dev/null
+++ b/man/getYmult.Rd
@@ -0,0 +1,17 @@
+\name{getYmult}
+\alias{getYmult}
+\title{Correct for aspect and coordinate ratio}
+\description{Calculate a multiplication factor for the Y dimension to correct
+ for unequal plot aspect and coordinate ratios on the current graphics device.}
+\usage{
+ getYmult()
+}
+\details{  
+ \samp{getYmult} retrieves the plot aspect ratio and the coordinate ratio for
+ the current graphics device, calculates a multiplicative factor to equalize
+ the X and Y dimensions of a plotted graphic object.
+}
+\value{The correction factor for the Y dimension.}
+\author{Jim Lemon}
+\seealso{\link{draw.circle}}
+\keyword{misc}
diff --git a/man/get_axispos3d.Rd b/man/get_axispos3d.Rd
new file mode 100755
index 0000000..c9e378a
--- /dev/null
+++ b/man/get_axispos3d.Rd
@@ -0,0 +1,19 @@
+\name{get_axispos3d}
+\alias{get_axispos3d}
+\title{ Get axis positions on a 3D plot }
+\description{
+ Calculate the axis positions on a 3D plot.
+}
+\usage{
+ get_axispos3d(edge,pmat,at,pos=NULL, dist=0)
+}
+\arguments{
+ \item{edge}{ which axis to calculate.}
+ \item{pmat}{ matrix to transform coordinates. }
+ \item{at}{ position on the axis. }
+ \item{pos}{ position of the axis relative to the other axes. }
+ \item{dist}{ Offset of the axis. }
+}
+\value{A position in 2D coordinates}
+\author{Ben Bolker}
+\keyword{misc}
diff --git a/man/gradient.rect.Rd b/man/gradient.rect.Rd
new file mode 100755
index 0000000..b44253c
--- /dev/null
+++ b/man/gradient.rect.Rd
@@ -0,0 +1,41 @@
+\name{gradient.rect}
+\title{Display a rectangle filled with an arbitrary color gradient}
+\usage{
+ gradient.rect(xleft,ybottom,xright,ytop,reds,greens,blues,col=NULL,
+  nslices=50,gradient="x",border=par("fg"))
+}
+\alias{gradient.rect}
+\arguments{
+ \item{xleft,ybottom,xright,ytop}{Positions of the relevant corners
+  of the desired rectangle, as in \samp{rect}.}
+ \item{reds,greens,blues}{vectors of the values of the color components
+  either as 0 to 1 or ,if any value is greater than 1, 0 to 255.}
+ \item{col}{Vector of colors. If supplied, this takes precedence over
+  \samp{reds, greens, blues} and \samp{nslices} will be set to its length.}
+ \item{nslices}{The number of sub-rectangles that will be drawn.}
+ \item{gradient}{whether the gradient should be horizontal (x) or vertical.}
+ \item{border}{The color of the border around the rectangle (NA for none).}
+}
+\description{
+ \samp{gradient.rect} draws a rectangle consisting of \samp{nslices}
+  subrectangles of the colors in \samp{col} or those returned by 
+  \samp{color.gradient} if \samp{col} is NULL. The rectangle is
+  'sliced' in the direction specified by \samp{gradient}.
+}
+\value{the vector of hexadecimal color values from \samp{color.gradient} or
+ \samp{col}.}
+\author{Jim Lemon}
+\examples{
+ # get an empty box
+ plot(0:10,type="n",axes=FALSE)
+ # run across the three primaries
+ gradient.rect(1,0,3,6,reds=c(1,0),
+  greens=c(seq(0,1,length=10),seq(1,0,length=10)),
+  blues=c(0,1),gradient="y")
+ # now a "danger gradient"
+ gradient.rect(4,0,6,6,c(seq(0,1,length=10),rep(1,10)),
+  c(rep(1,10),seq(1,0,length=10)),c(0,0),gradient="y")
+ # now just a smooth gradient across the bar
+ gradient.rect(7,0,9,6,col=smoothColors("red",38,"blue"),border=NA)
+}
+\keyword{misc}
diff --git a/man/hexagon.Rd b/man/hexagon.Rd
new file mode 100755
index 0000000..0f1ac38
--- /dev/null
+++ b/man/hexagon.Rd
@@ -0,0 +1,27 @@
+\name{hexagon}
+\alias{hexagon}
+\title{Draw a hexagon}
+\description{
+ Draws a hexagon on the current graphic device
+}
+\usage{
+ hexagon(x,y,unitcell=1,col=NA,border="black")
+}
+\arguments{
+ \item{x,y}{x and y position of the bottom left corner of the square that
+  would pack into the same space as the hexagon.}
+ \item{unitcell}{The dimension of the side of the abovementioned square.}
+ \item{col}{The color to fill the hexagon - default is no fill.}
+ \item{border}{The color of the perimeter of the hexagon.}
+}
+\note{
+ Draws a hexagon with the same center as a square that would pack into the
+ same dimensions as the hexagon. That is, given a grid of squares with
+ alternate rows shifted one half the length of the sides, the hexagons
+ drawn would be close packed. Its use in the plotrix package is to provide
+ an alternative unit cell for the \samp{color2D.matplot} function.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{color2D.matplot}}
+\keyword{misc}
diff --git a/man/histStack.Rd b/man/histStack.Rd
new file mode 100644
index 0000000..4ddf284
--- /dev/null
+++ b/man/histStack.Rd
@@ -0,0 +1,70 @@
+\name{histStack}
+\alias{histStack}
+\alias{histStack.formula}
+\alias{histStack.default}
+\title{Histogram "stacked" by categories}
+\description{
+ Histogram of a quantitative variable with bars that are "stacked" by the
+ values of a factor variable.
+}
+\usage{
+ histStack(x,...)
+
+ \method{histStack}{formula}(x,data,breaks="Sturges",col="rainbow",
+  right=TRUE,main="",xlab=NULL,legend.pos=NULL,cex.legend=0.75,...)
+
+ \method{histStack}{default}(x,z,breaks="Sturges",col="rainbow",
+  right=TRUE,main="",xlab=NULL,legend.pos=NULL,cex.legend=0.75,...)
+}
+\arguments{
+ \item{x}{A vector of quantitative data or a formula of the form x~z
+ (see z below).}
+ \item{z}{A vector of categorical data (a factor) that will define the
+  \dQuote{stacks}.}
+ \item{data}{A data frame that contains both x and z.}
+ \item{breaks}{Breaks to use in categorizing values of x.}
+ \item{col}{Either a vector of colors in any legitimate form or a
+  character string that specifies a function that requires only the length
+  of the vector as an argument and will return a vector of colors with that
+  length. (see Details)}
+ \item{right}{A logical that indicates whether the bins are right-open
+  (left-closed; =TRUE) or right-closed (left-open; =FALSE; default).}
+ \item{main}{A character string that forms the main title for the plot.}
+ \item{xlab}{A character string for labeling the x-axis.}
+ \item{legend.pos}{A character string or two numeric values indicating the
+  position for the stacking legend.}
+ \item{cex.legend}{A numeric character expansion value for the legend.
+  Values less than 1 will make the legend smaller.}
+ \item{...}{Additional arguments sent to the hist function.}
+}
+\details{
+ \samp{histStack} displays a \dQuote{stacked histogram} while using many of
+ the same arguments as hist(). The argument \samp{z} will be converted to a
+ factor with a warning if it is not already a factor.
+
+ The color functions in \pkg{grDevices} (e.g. "gray.colors") should always
+ be valid when passed as the \samp{col} argument. Any function that will
+ return a vector of \samp{n} colors when called with a single argument
+ \samp{n} and that exists in the current environment should work. An error
+ will occur if length(col)==1 and the value is not a function as described
+ for \samp{col} (e.g., \samp{col="blue"} will result in an error).If fewer
+ colors than levels of \samp{z} are passed, they will be recycled.
+}
+\value{nil. A plot is displayed.}
+\note{
+ This function is currently experimental.
+}
+\author{Derek Ogle with modifications by Jim Lemon}
+\seealso{\link{hist}, \link{legend}} 
+\examples{
+ set.seed(409)
+ df<-data.frame(len=rnorm(100)+5,
+  grp=sample(c("A","B","C","D"),100,replace=TRUE))
+ histStack(len~grp,data=df,main="Default (rainbow) colors",
+  xlab="Length category")
+ histStack(len~grp,data=df,col="heat.colors",main="Heat colors",
+  xlab="Length category",legend.pos="topright")
+ histStack(len~grp,data=df,col=2:5,main="Colors by number",
+  xlab="Length category",legend.pos=c(2.8,18))
+}
+\keyword{misc}
diff --git a/man/intersectDiagram.Rd b/man/intersectDiagram.Rd
new file mode 100755
index 0000000..69877f7
--- /dev/null
+++ b/man/intersectDiagram.Rd
@@ -0,0 +1,144 @@
+\name{intersectDiagram}
+\alias{intersectDiagram}
+\title{Display set intersections}
+\description{Display set intersections as rows of rectangles.}
+\usage{
+ intersectDiagram(x,pct=FALSE,show.nulls=FALSE,xnames=NULL,sep="+",
+  mar=c(0,0,3,0),main="Intersection Diagram",cex=1,col=NULL,
+  minspacing=NA,all.intersections=FALSE,include=NULL,null.label="Non-set")
+}
+\arguments{
+ \item{x}{A list containing as many numeric vectors as there are sets. The
+  first vector contains the counts or percentages of the elements that are
+  only in one set, the next vector contains the counts or percentages of 
+  elements that are in two sets and so on. A matrix of set membership
+  indicators or a two column matrix of object identifiers and attribute
+  identifiers can be passed - see Details.}
+ \item{pct}{Whether to display counts (FALSE) or percentages (TRUE) of the
+  number of entities.}
+ \item{show.nulls}{Whether to display the number of original objects that 
+  are not members of any set. Any value that is not NA will become the 
+  label for this category.}
+ \item{xnames}{Optional user supplied names for the set categories (see
+  Details).}
+ \item{sep}{The separator to use between category names (see Details).}
+ \item{mar}{The margins for the diagram. The margins that were in effect when
+  the function is called are restored.}
+ \item{main}{The title for the diagram.}
+ \item{col}{Colors for the sets (see Details).}
+ \item{cex}{Character expansion for the intersection labels.}
+ \item{minspacing}{The minimum spacing between the rectangles (see Details).}
+ \item{all.intersections}{Whether to display all intersections, even if empty
+  (Dangerous - see Detail).}
+ \item{include}{Which set identifiers to include in the diagram (see Details).}
+ \item{null.label}{The label for the non-set entities if displayed.}
+}
+\details{
+ \samp{intersectDiagram} displays rows of optionally colored rectangles that
+ represent the intersections of set memberships (attributes) of a set of objects.
+ The topmost row represents the intersections of the fewest sets, and
+ succeeding rows represent the intersections of more sets. If there were objects
+ in the original data set that were not members of any set, any percentages
+ calculated will reflect this. By setting \samp{show.nulls} to TRUE, the counts
+ or percentages of such objects will be displayed below the intersections over
+ an empty rectangle scaled to the count or percentage.
+
+ Important - If the \samp{all.intersections} argument is TRUE, all intersections
+ will be displayed, whether empty or not (see the example). This is mostly for
+ demonstration purposes, and if the number of sets is large, is likely to produce
+ a very messy diagram. Similarly, sets with large numbers of
+ intersections that are populated will require very large displays to be readable,
+ even if there are small numbers in the intersections. If you would like to see
+ this in action, pass the data frame \samp{setdf} in the \link{categoryReshape}
+ example to \samp{intersectDiagram} with \samp{all.intersections} TRUE.
+
+ \samp{intersectDiagram} does not attempt to display the set intersections as
+ a pattern of overlapping geometric figures, but rather the relative numbers of
+ objects sharing each intersection. More than three intersecting sets generally
+ produce a complex and difficult to interpret Venn diagram, and this provides an
+ alternative way to display the size of intersections between larger numbers
+ of sets.
+
+ \samp{intersectDiagram} now allows the user to display only part of the 
+ set intersections, which is useful for analyzing very complex intersections.
+ This is controlled by the \samp{include} argument. This defaults to all sets or 
+ attributes when \samp{include=NULL}. If one or more of the labels of the sets or 
+ attributes is passed, only the intersections containing those labels will be 
+ displayed. See examples 2 and 3 below.
+ 
+ Each set (attribute) is assigned a color if \samp{col} is not NA. \samp{rainbow}
+ is called if \samp{col} is NULL, otherwise the colors passed are used. For each
+ intersection, the colors representing the sets intersecting are included in
+ the rectangle.
+ 
+ The strings displayed on each rectangle are taken from the argument
+ \samp{xnames} unless that is NULL, then the \samp{names} of the intersectList
+ object passed as \samp{x} or returned from the call to \samp{makeIntersectList}.
+ 
+ If a matrix or data frame of set membership indicators is passed as \samp{x},
+ it will be passed to \link{makeIntersectList} for conversion. Each column must
+ represent a set, and the values in the columns must be 0 or 1, or FALSE or TRUE.
+ Similarly, if a matrix or data frame in which the first column is object
+ identifiers and the second column is attributes, this will be passed to
+ \samp{makeIntersectList}.
+
+ The spacing between the largest rectangles is controlled by \samp{minspacing}.
+ \samp{minspacing} is in units of object counts and defaults to 0.1 times the
+ largest number of objects in an intersection. When the number of objects in
+ different intersections at a given level varies widely, the labels of
+ intersections with few objects may overlap if they are wide relative to the
+ rectangle representing the number of objects. This can be corrected by
+ passing a \samp{minspacing} argument that will increase the space between
+ rectangles and/or decreasing the character size of the labels. If the labels
+ for each set are relatively long, setting \samp{namesep="\n"} may help. Note 
+ that if a different separator is passed, that separator must be explicitly
+ passed in any subsequent calls using the same \samp{intersectList} object - see
+ examples 1 to 3 below.
+}
+\value{
+ Returns the intersectionList object invisibly.
+}
+\keyword{misc}
+\author{Jim Lemon}
+\seealso{\link{makeIntersectList}, \link{getIntersectList}, \link{categoryReshape}}
+\examples{
+ # create a matrix where each row represents an element and
+ # a 1 (or TRUE) in each column indicates that the element is a member
+ # of that set.
+ druguse<-matrix(c(sample(c(0,1),200,TRUE,prob=c(0.15,0.85)),
+  sample(c(0,1),200,TRUE,prob=c(0.35,0.65)),
+  sample(c(0,1),200,TRUE,prob=c(0.5,0.5)),
+  sample(c(0,1),200,TRUE,prob=c(0.9,0.1))),ncol=4)
+ colnames(druguse)<-c("Alc","Tob","THC","Amp")
+ druglist<-makeIntersectList(druguse,sep="\n")
+ # first display it as counts
+ intersectDiagram(druglist,main="Patterns of drug use",sep="\n")
+ # then display only the intersections containing "Alc"
+ intersectDiagram(druglist,main="Patterns of drug use (Alcohol users only)",
+  sep="\n",include="alc")
+ # now display only the intersections containing "Amp"
+ intersectDiagram(druglist,main="Patterns of drug use (Speed users only)",
+  sep="\n",include="amp")
+ # then as percent with non.members, passing the initial matrix
+ intersectDiagram(druguse,pct=TRUE,show.nulls=TRUE)
+ # alter the data to have more multiple intersections
+ druguse[which(as.logical(druguse[,1]))[1:40],2]<-1
+ druguse[which(as.logical(druguse[,1]))[31:70],3]<-1
+ druguse[,4]<-sample(c(0,1),200,TRUE,prob=c(0.9,0.1))
+ intersectDiagram(druguse,main="Smaller font in labels",
+  col=c("gray20","gray40","gray60","gray80"),cex=0.8)
+ # transform the spacing - usually makes it too close, first try minspacing
+ intersectDiagram(druguse,col="gray",main="Minimum spacing = 30 cases",
+  minspacing=30)
+ # then try cex - may need both for large differences
+ intersectDiagram(druguse,main="Very boring single color",col="gray",cex=0.8)
+ # create a matrix with empty intersections
+ druguse<-matrix(c(sample(c(0,1),20,TRUE),
+  sample(c(0,1),20,TRUE),
+  sample(c(0,1),20,TRUE),
+  sample(c(0,1),20,TRUE)),ncol=4)
+ # show only the populated intersections
+ intersectDiagram(druguse,main="Display only populated intersections")
+ # show all intersections
+ intersectDiagram(druguse,main="Display empty intersections",all.intersections=TRUE)
+}
diff --git a/man/jiggle.Rd b/man/jiggle.Rd
new file mode 100644
index 0000000..adcb775
--- /dev/null
+++ b/man/jiggle.Rd
@@ -0,0 +1,33 @@
+\name{jiggle}
+\alias{jiggle}
+\title{ Calculate equally spaced values within a range. }
+\description{
+ Calculates a specified number of equally spaced values in a range
+}
+\usage{
+ jiggle(n,range=c(-1,1))
+}
+\arguments{
+ \item{n}{The number of values to calculate.}
+ \item{range}{The range within which to fit the values.}
+}
+\details{
+ \samp{jiggle} is an alternative to the \samp{jitter} function. Instead
+ of using \samp{runif} to provide the values, it calls \samp{sample}
+ and then scales the resulting values to the range specified. This
+ guarantees that the values will be evenly spaced.
+}
+\value{ A vector of n values within the range specified. }
+\author{Jim Lemon}
+\examples{
+ ahw.df<-data.frame(Age=rnorm(100,35,10),
+  Height=rnorm(100,160,15),Weight=rnorm(100,75,20))
+ par(mfrow=c(1,3))
+ boxplot(ahw.df$Age,main="Age")
+ points(jiggle(100,c(0.5,1.5)),ahw.df$Age,col="red")
+ boxplot(ahw.df$Height,main="Height")
+ points(jiggle(100,c(0.5,1.5)),ahw.df$Height,col="green")
+ boxplot(ahw.df$Weight,main="Weight")
+ points(jiggle(100,c(0.5,1.5)),ahw.df$Weight,col="blue")
+}
+\keyword{misc}
diff --git a/man/kiteChart.Rd b/man/kiteChart.Rd
new file mode 100755
index 0000000..20cf37c
--- /dev/null
+++ b/man/kiteChart.Rd
@@ -0,0 +1,93 @@
+\name{kiteChart}
+\alias{kiteChart}
+\title{ Magnitude by position chart. }
+\description{
+ Display numeric values as the widths of a polygon along a dimension such as time.
+}
+\usage{
+ kiteChart(x,xlim=NA,ylim=NA,timex=TRUE,main="Kite chart",
+ xlab=ifelse(timex,"Time","Groups"),ylab=ifelse(timex,"Groups","Time"),
+ border=par("fg"),col=NULL,varpos=NA,varlabels=NA,varscale=FALSE,
+ timepos=NA,timelabels=NA,mar=c(5,4,4,4),axlab=c(1,2,3,4),
+ normalize=FALSE,shownorm=TRUE,...)
+}
+\arguments{
+ \item{x}{Numeric matrix or data frame}
+ \item{xlim}{Horizontal extent of the chart. Defaults to 1:dim(x)[2].}
+ \item{ylim}{Vertical extent of the chart. Defaults to 0.5:dim(x)[1]+0.5.}
+ \item{timex}{Whether the "time" axis is x (horizontal) or not.}
+ \item{main,xlab,ylab}{As in \samp{plot}.}
+ \item{border}{The border color(s) for the polygons.}
+ \item{col}{The fill colors for the polygons.}
+ \item{varpos}{Optional positions for the "kite lines". Defaults to 1:dimx[1].
+  (see Details)}
+ \item{varlabels}{Labels for the rows of values - defaults to the rownames,
+  or if these are missing, varpos[1:dim(x)[1]].}
+ \item{varscale}{Whether to show the maximum extent of each "kite line".}
+ \item{timepos}{The positions of the values along the x axis, usually times,
+  defaulting to 1:dim(x)[2].}
+ \item{timelabels}{Labels for the positions, defaulting to \samp{timepos}.}
+ \item{mar}{Plot margins. These leave space for the normalization multipliers
+  on the right or top side (see Details).}
+ \item{axlab}{Where to put axis tick labels and multipliers. See Details.}
+ \item{normalize}{Whether to scale each row of values to a maximum width of 1.}
+ \item{shownorm}{Whether to display the normalization multipliers.}
+ \item{...}{additional arguments passed to \samp{plot}.}
+}
+\details{
+ \samp{kiteChart} displays each row of \samp{x} as a sequence of widths, allowing
+ the relationships between those values and the dimension along which they occur
+ (usually time) to be illustrated.
+
+ The values in x are scaled to a maximum polygon width of 1 if \samp{normalize}
+ is TRUE. This is to avoid overlapping of the polygons. There may be some cases
+ where the values can be displayed directly. If normalized, the multipliers will
+ be displayed for each row on the right or top side of the chart unless \samp{shownorm}
+ is FALSE. Remember to specify the \samp{mar} argument if more space at the top
+ is needed.
+
+ The \samp{axlab} argument allows the user to place the axis tick labels and
+ normalization multipliers on different axes. The default places the tick labels
+ on the bottom and left sides of the plot and the multipliers on the right or top.
+ Using \samp{axlab=c(3,4,1,2)} places the tick labels on the top and right and the 
+ multipliers on the left or bottom. The \samp{mar} argument may have to be adjusted.
+
+ The user can display raw values by default, or by setting \samp{varpos} to TRUE.
+ Setting \samp{varpos} to a vector of positions will place the "kite lines" on those
+ values. If there are no row names and the \samp{varlabels} argument is NA, the values
+ of \samp{varpos} will be used as labels for each "kite line". The maximum extent of
+ each "kite line" can be displayed by setting \samp{varscale} to TRUE. If
+ \samp{varscale} is TRUE, one extra line will be added to the top margin. If
+ \samp{varpos[1]} is not NA, \samp{normalize} is FALSE by default.
+}
+\value{The values of \samp{mar} that were current when \samp{kiteChart} was called.}
+\author{Jim Lemon (Thanks to Michael Bedward for suggestions on the arguments and
+ Nikolaus Lampadariou for the suggestions on displaying raw values)}
+\seealso{\link{polygon}}
+\examples{
+ testmat<-matrix(c(runif(50),sample(1:50,50),rnorm(50)+5,
+  sin(1:50)),ncol=50,byrow=TRUE)
+ kiteChart(testmat,varlabels=c("Uniform","Sample","Normal","Sine"),
+  timepos=seq(1,50,by=5),timex=FALSE)
+ # not enough space for the last label, add it
+ mtext("Sine",at=65,side=1,line=2)
+ # now show it with kite line maxima
+ kiteChart(testmat,varlabels=c("Uniform","Sample","Normal","Sine"),
+  timepos=seq(1,50,by=5),timex=FALSE,varscale=TRUE)
+ mtext("Sine",at=65,side=1,line=2)
+ musicmat<-matrix(c(c(0.5,0.4,0.3,0.25,0.2,0.15,0.1,rep(0.05,44))+runif(51,0,0.05),
+  c(0.1,0.2,0.3,0.35,0.4,0.5,0.4,rep(0.5,14),rep(0.4,15),rep(0.3,15))+runif(51,0,0.1),
+  rep(0.15,51)+runif(51,0,0.1),
+  c(rep(0,29),c(0.1,0.2,0.4,0.5,0.3,0.2,rep(0.05,16))+runif(22,0,0.05)),
+  c(rep(0,38),c(rep(0.05,6),0.08,0.15,0.20,0.25,0.2,0.25,0.3)+runif(13,0,0.05))),
+  ncol=51,byrow=TRUE)
+ kiteChart(musicmat,varlabels=c("Swing","Rock","Jazz","Disco","Rap"),
+  main="An utterly imaginary chart of music popularity",
+  timepos=seq(1,51,by=10),timelabels=seq(1950,2000,by=10),mar=c(5,4,4,2))
+ # now flip it to vertical, normalize and show the normalization factors
+ kiteChart(musicmat,varlabels=c("Swing","Rock","Jazz","Disco","Rap"),
+  main="An utterly imaginary chart of music popularity",xlab="Style",
+  timepos=seq(1,51,by=10),timelabels=seq(1950,2000,by=10),mar=c(5,4,4,2),
+  timex=FALSE,normalize=TRUE,shownorm=TRUE)
+}
+\keyword{misc}
diff --git a/man/labbePlot.Rd b/man/labbePlot.Rd
new file mode 100644
index 0000000..1818071
--- /dev/null
+++ b/man/labbePlot.Rd
@@ -0,0 +1,65 @@
+\name{labbePlot}
+\alias{labbePlot}
+\title{ Display a L'Abbe plot }
+\description{
+ Display the percentages of successes for two conditions to be compared as circles,
+ the area of which is proportional to the number of observations.
+}
+\usage{
+ labbePlot(x,main="L'Abbe plot",xlab="Percent positive response with placebo",
+ ylab="Percent positive response with treatment",labels=NULL,col=NA,
+ circle.mag=0.5,add=FALSE,...)
+}
+\arguments{
+ \item{x}{A list of either 2x2 tables or three element vectors (see Details).}
+ \item{main}{The title of the plot.}
+ \item{xlab,ylab}{The x and y axis labels as in \samp{plot}.}
+ \item{labels}{Text strings that will be displayed in the center of the circles.}
+ \item{col}{A list of colors for the circles.}
+ \item{circle.mag}{A fudge factor for very small or very large numbers of
+  observations.}
+ \item{add}{Whether to add the information in \samp{x} to an existing L'Abbe
+  plot.}
+ \item{...}{additional arguments passed to \samp{plot}.}
+}
+\details{
+ The elements of \samp{x} may be tables in which rows represent the conditions
+ being compared, with the comparison condition first (often "placebo") and the 
+ condition of interest (often "intervention") second. The columns represent the
+ counts of successes and failures. The elements of \samp{x} can also be vectors
+ with three numeric values, first the percentage of successes for the comparison
+ condition, second the percentage of successes for the condition of interest and
+ finally the number of observations. Tables and vectors can be mixed.
+
+ The radius of each circle is the square root of the number of observations
+ multiplied by \samp{circle.mag}. This allows very small numbers of observations
+ to be expanded and very large numbers to be reduced in size. As the area of each
+ circle is proportional to the number of observations, \samp{circle.mag} must be
+ the same for all circles. The user may wish to expand or contract all the circles
+ on a plot so that they will fit within the box.
+
+ The labels, if not NULL, are displayed on the circles. The function tries to work
+ out whether white or black text will be more easily read based on the background
+ color and displays the text accordingly.
+}
+\value{nil}
+\author{Jim Lemon - thanks to Whitney Melroy for asking for it.}
+\seealso{\link{draw.circle}}
+\examples{
+ # first fake something like the data from a clinical trial
+ didf<-data.frame(subject=1:50,interv=rep(c("therapist","ex-drinker"),each=25),
+  outcome=sample(c("more","less"),50,TRUE))
+ # make it into a table
+ didf.tab<-table(didf$interv,didf$outcome)
+ # now mix in some raw percentages just for the example
+ didf2<-c(74,46,200)
+ didf3<-c(33,87,500)
+ x<-list(didf.tab,didf2,didf3)
+ labbecol<-list("red","green","blue")
+ labbePlot(x,main="Ex-drinkers vs therapists",
+  xlab="Percent reduced drinking (ex-drinkers)",
+  ylab="Percent reduced drinking (therapists)",
+ labels=list("A","B52","X117"),col=labbecol)
+ labbePlot(list(c(20,40,20)),col=list("purple"),labels=list("Z"),add=TRUE)
+}
+\keyword{misc}
diff --git a/man/ladderplot.Rd b/man/ladderplot.Rd
new file mode 100755
index 0000000..e518494
--- /dev/null
+++ b/man/ladderplot.Rd
@@ -0,0 +1,89 @@
+\name{ladderplot}
+\Rdversion{1.1}
+\alias{ladderplot}
+\alias{ladderplot.default}
+\title{
+Ladder Plot
+}
+\description{
+Makes a ladder plot, similar to \link[MASS]{parcoord} but with more
+flexibility and graphical options.
+}
+\usage{
+ladderplot(x, ...)
+\method{ladderplot}{default}(x, scale=FALSE, col=1, pch=19, lty=1, 
+xlim=c(0.5, ncol(x) + 0.5), ylim=range(x), vertical = TRUE, ordered=FALSE,...)
+}
+\arguments{
+  \item{x}{
+A matrix or data frame with at least 2 columns.
+}
+  \item{scale}{
+Logical, if the original data columns should be scaled to the unit (0-1) interval.
+}
+  \item{col}{
+Color values to use for rows of \samp{x}. If longer than 1, its value is recycled.
+}
+  \item{pch}{
+Point type to use. If longer than 1, its value is recycled.
+}
+  \item{lty}{
+Line type to use. If longer than 1, its value is recycled.
+}
+  \item{xlim, ylim}{
+Limits for axes.
+}
+  \item{vertical}{
+Logical, if the orientation of the ladderplot should be vertical or horizontal.
+}
+  \item{ordered}{
+Logical, if the columns in \samp{x} should be ordered.
+}
+  \item{\dots}{
+Other arguments passed to the function \link{stripchart}.
+}
+}
+\details{
+The function uses \link{stripchart} to plot 1-D scatter plots for each column
+ in \samp{x}. Then points are joined by lines for each rows of \samp{x}.
+}
+\value{
+Makes a plot as a side effect.
+Returns \samp{NULL} invisibly.
+}
+\author{
+Peter Solymos <solymos at ualberta.ca>
+}
+\seealso{
+\link{lines}, \link{points}, \link{stripchart}
+
+Almost identical function: \link[MASS]{parcoord}
+}
+\examples{
+x<-data.frame(A=c(1:10), B=c(2:11)+rnorm(10))
+y<-data.frame(x, C=c(1:10)+rnorm(10))
+opar <- par(mfrow=c(1,3))
+ladderplot(x)
+ladderplot(x, col=1:10, vertical=FALSE)
+ladderplot(y, col=1:10)
+par(opar)
+
+## examples from parcoord
+\dontrun{
+if (require(MASS)) {
+opar <- par(mfrow=c(2,3))
+z1 <- state.x77[, c(7, 4, 6, 2, 5, 3)]
+parcoord(z1, main="parcoord state.x77")
+ladderplot(z1, pch=NA, scale=TRUE, main="ladderplot state.x77 original")
+ladderplot(z1, main="ladderplot state.x77 original")
+ir <- rbind(iris3[,,1], iris3[,,2], iris3[,,3])
+z2 <- log(ir)[, c(3, 4, 2, 1)]
+parcoord(z2, col = 1 + (0:149))
+ladderplot(z2, scale=TRUE, col = 1 + (0:149),
+    main="ladderplot iris original")
+ladderplot(z2, col = 1 + (0:149))
+par(opar)
+}
+}
+}
+\keyword{ aplot }
diff --git a/man/legendg.Rd b/man/legendg.Rd
new file mode 100755
index 0000000..4742dbb
--- /dev/null
+++ b/man/legendg.Rd
@@ -0,0 +1,76 @@
+\name{legendg}
+\alias{legendg}
+\title{Legend with grouped bars, lines or symbols}
+\description{Displays a legend with more than one rectangle, symbol or line.}
+\usage{
+ legendg(x,y=NULL,legend,fill=NULL,col=par("col"),          
+ border=list("black"),lty,lwd,pch=NULL,angle=45,density=NULL,       
+ bty="o",bg=par("bg"),box.lwd=par("lwd"),box.lty=par("lty"), 
+ box.col=par("fg"),pt.bg=NA,cex=1,pt.cex=cex,pt.lwd=lwd,  
+ pt.space=1,xjust=0,yjust=1,x.intersp=1,y.intersp=1,
+ adj=c(0,0.5),text.width=NULL,text.col=par("col"),merge=FALSE,
+ trace=FALSE,plot=TRUE,ncol=1,horiz=FALSE,title=NULL,
+ inset=0,xpd,title.col=text.col)
+}
+\arguments{
+ \item{x,y}{Position of the legend as in \samp{legend}.}
+ \item{legend}{Labels for the legend as in \samp{legend}.}
+ \item{fill}{List of fill colors for the rectangles.}
+ \item{col}{Color(s), perhaps as a list, for the symbols.}
+ \item{border}{Border color(s) for the rectangles.}
+ \item{lty}{Line type, currently ignored and set to 1.}
+ \item{lwd}{Line width, currently ignored.}
+ \item{pch}{List of symbols for the legend.}
+ \item{angle,density}{Currently ignored.}
+ \item{bty}{Legend box type to be displayed.}
+ \item{bg}{Background color for the legend.}
+ \item{box.lwd,box.lty,box.col}{Line width, type and color
+  for the surrounding box.}
+ \item{cex}{Character expansion for text.}
+ \item{pt.bg,pt.cex,pt.lwd}{Background color, character
+  expansion and line width for the symbols.}
+ \item{pt.space}{Spacing for the symbols as a multiplier
+  for \samp{strwidth("O")}.}
+ \item{xjust,yjust}{Justification for the legend.}
+ \item{x.intersp,y.intersp}{x and y character spacing for
+  the legend text.}
+ \item{adj}{Text adjustment.}
+ \item{text.width,text.col}{Width and color of the legend text.}
+ \item{merge}{Whether to merge points and lines.}
+ \item{trace}{Show how the legend is calculated.}
+ \item{plot}{Whether to plot the legend.}
+ \item{ncol}{Number of columns in the legend.}
+ \item{horiz}{Whether to display a horizontal legend.}
+ \item{title}{Title for the legend.}
+ \item{inset}{Inset distances for use with keywords.}
+ \item{xpd}{An optional value for \samp{par(xpd=)}.}
+ \item{title.col}{Color for the legend title.}
+}
+\value{
+ The value returned by \samp{legend} returned invisibly.
+}
+\details{
+ \samp{legendg} calls \samp{legend} to display a legend with a
+ blank space to the left of the labels. It then attempts to display
+ groups of colored rectangles or symbols in that space depending
+ upon the contents of either \samp{fill} or \samp{pch}. These
+ should be in the form of a list with the number of elements equal
+ to the number of labels, and one or more fills or symbols for each
+ label. \samp{legendg} will display up to four fills or symbols
+ next to each label, allowing the user to label a group of these
+ rather than just one per label.
+}
+\author{Jim Lemon}
+\seealso{\link{legend}}
+\examples{
+ plot(0.5,0.5,xlim=c(0,1),ylim=c(0,1),type="n",
+  main="Test of grouped legend function")
+ legendg(0.5,0.8,c("one","two","three"),pch=list(1,2:3,4:6),
+  col=list(1,2:3,4:6),pt.space=1.5)
+ legendg(0.5,0.5,c("one","two","three"),fill=list(1,2:3,4:6))
+ # fake a line/point with text points
+ legendg(0.2,0.25,c("letter","number"),
+  pch=list(c("-","A","-"),c("-","1","-")),
+  col=list(rep(2,3),rep(3,3)))
+}
+\keyword{misc}
diff --git a/man/lengthKey.Rd b/man/lengthKey.Rd
new file mode 100755
index 0000000..e5e650c
--- /dev/null
+++ b/man/lengthKey.Rd
@@ -0,0 +1,32 @@
+\name{lengthKey}
+\alias{lengthKey}
+\title{Key for interpreting lengths in a plot}
+\description{Key for interpreting lengths in a plot}
+\usage{
+ lengthKey(x,y,tickpos,scale)
+}
+\arguments{
+ \item{x,y}{The position of the left end of the key in user units.}
+ \item{tickpos}{The labels that will appear above the key.}
+ \item{scale}{A value that will scale the length of the key.}
+}
+\value{nil}
+\details{
+ \samp{lengthKey} displays a line with tick marks and the values in
+ \samp{tickpos} above those tickmarks. It is useful when line segments
+ on a plot represent numeric values. Note that if the plot does not have
+ a 1:1 aspect ratio, a length key is usually misleading.
+}
+\author{Jim Lemon}
+\seealso{\link{segments}, \link{arrows}}
+\examples{
+ # manufacture a matrix of orientations in radians
+ o<-matrix(rep(pi*seq(0.1,0.8,by=0.1),7),ncol=8,byrow=TRUE)
+ m<-matrix(rnorm(56)+4,ncol=8,byrow=TRUE)
+ # get an empty plot of approximately 1:1 aspect ratio
+ plot(0,xlim=c(0.7,8.3),ylim=c(0.7,7.3),type="n")
+ vectorField(o,m,vecspec="rad")
+ # the scaling usually has to be worked out by trial and error
+ lengthKey(0.3,-0.5,c(0,5,10),0.24)
+}
+\keyword{misc}
diff --git a/man/listDepth.Rd b/man/listDepth.Rd
new file mode 100755
index 0000000..f790485
--- /dev/null
+++ b/man/listDepth.Rd
@@ -0,0 +1,16 @@
+\name{listDepth}
+\alias{listDepth}
+\title{Find the maximum depth of a list}
+\description{Descend a list and find the maximum number of levels.}
+\usage{ listDepth(x) }
+\arguments{
+ \item{x}{A list.}
+}
+\details{
+ A possibly nested list of lists is descended to determine the maximum number
+ of levels. Currently used to set up the dimensions of a dendrite plot.
+}
+\value{The maximum number of levels in the list.}
+\keyword{misc}
+\author{Jim Lemon}
+\seealso{\link{plot.dendrite}}
diff --git a/man/makeDendrite.Rd b/man/makeDendrite.Rd
new file mode 100755
index 0000000..17bc317
--- /dev/null
+++ b/man/makeDendrite.Rd
@@ -0,0 +1,35 @@
+\name{makeDendrite}
+\alias{makeDendrite}
+\title{Build a list of the mutually exclusive attributes of objects}
+\description{Build a list of mutually exclusive attributes from a matrix of 
+ category indicators.}
+\usage{
+ makeDendrite(x)
+}
+\arguments{
+ \item{x}{A data frame or matrix where rows represent objects and columns
+  mutually exclusive attributes of a given class.}
+}
+\details{  
+ The values in \samp{x} indicate which attribute of a particular class is
+  possessed by the object. For instance, the attributes dead and alive are
+  mutually exclusive. \samp{makeDendrite} creates a nested list that contains
+  the counts of successive combinations of the attributes. The top level
+  attributes are taken from the first column, then those are combined with
+  the attributes in the second column and so on.
+}
+\value{
+ A list of the counts of objects for each combination of the attribute
+ classes.
+}
+\keyword{misc}
+\author{Jim Lemon}
+\seealso{\link{plot.dendrite}}
+\examples{
+ sex<-sample(c("M","F"),100,TRUE)
+ hair<-sample(c("Blond","Black","Brown","Red"),100,TRUE)
+ eye<-sample(c("Blue","Black","Brown","Green"),100,TRUE)
+ charac<-data.frame(sex=sex,hair=hair,eye=eye)
+ characlist<-makeDendrite(charac)
+ characlist
+}
diff --git a/man/makeIntersectList.Rd b/man/makeIntersectList.Rd
new file mode 100755
index 0000000..c2dd944
--- /dev/null
+++ b/man/makeIntersectList.Rd
@@ -0,0 +1,62 @@
+\name{makeIntersectList}
+\alias{makeIntersectList}
+\title{Count set intersections}
+\description{Create a list of set intersections from a matrix of indicators}
+\usage{
+ makeIntersectList(x,xnames=NULL,sep="+")
+}
+\arguments{
+ \item{x}{A data frame or matrix where rows represent objects and columns
+  attributes. A \samp{1} or \samp{TRUE} indicates that the object (row) has
+  that attribute or is a member of that set (column). \samp{x} can also be
+  a matrix or data frame in which the first column contains object identifiers
+  and the second contains attribute codes.}
+ \item{xnames}{Optional user-supplied names for the attributes of x.}
+ \item{sep}{A character to use as a separator for attribute labels.}
+}
+\details{
+ \samp{makeIntersectList} reads a matrix (or data frame where all values are the
+ same type) containing dichotomous values (either 0/1 or FALSE/TRUE) or labels
+ (see next paragraph). In the first type of input, each row represents an object
+ and each column represents a set. A value of 1 or TRUE indicates that that
+ object is a member of that set. The function creates a list of vectors that
+ correspond to all combinations of the sets (set intersections) and inserts the
+ counts of elements in each combination. If a row of \samp{x} is all zeros,
+ it will not be counted, but the second last element of the list returned
+ contains the count of rows in \samp{x} and thus non-members can be calculated.
+
+ If a matrix (or data frame where all values are the same type) containing values 
+ other than 0/1 or TRUE/FALSE, it will be passed to \samp{categoryReshape} for
+ conversion to a data frame as described above. See \samp{categoryReshape} for
+ details of this.
+ 
+ makeIntersectList combines the set or attribute names to form
+ intersection names. For the intersection of sets A and B, the name will
+ be A+B (unless \samp{sep} is changed) and so on. These are the names that will
+ be displayed by \samp{intersectDiagram}. To change these, use the \samp{xnames}
+ argument.
+}
+\value{
+ A list of the intersection counts or percentages, the total number of
+ objects and the attribute codes.
+}
+\keyword{misc}
+\author{Jim Lemon}
+\seealso{\link{intersectDiagram}, \link{pasteCols}, link{categoryReshape}}
+\examples{
+ # create a matrix where each row represents an element and
+ # a 1 (or TRUE) in each column indicates that the element is a member
+ # of that set.
+ setdf<-data.frame(A=sample(c(0,1),100,TRUE,prob=c(0.7,0.3)),
+  B=sample(c(0,1),100,TRUE,prob=c(0.7,0.3)),
+  C=sample(c(0,1),100,TRUE,prob=c(0.7,0.3)),
+  D=sample(c(0,1),100,TRUE,prob=c(0.7,0.3)))
+ makeIntersectList(setdf)
+ ns<-sample(1:8,20,TRUE)
+ objects<-0
+ for(i in 1:length(ns)) objects<-c(objects,rep(i,ns[i]))
+ attributes<-"Z"
+ for(i in 1:length(ns)) attributes<-c(attributes,sample(LETTERS[1:8],ns[i]))
+ setdf2<-data.frame(objects[-1],attributes[-1])
+ makeIntersectList(setdf2)
+}
diff --git a/man/maxEmptyRect.Rd b/man/maxEmptyRect.Rd
new file mode 100644
index 0000000..35253f2
--- /dev/null
+++ b/man/maxEmptyRect.Rd
@@ -0,0 +1,44 @@
+\name{maxEmptyRect}
+\alias{maxEmptyRect}
+\title{ Find an empty space on a plot }
+\description{
+ Try to find the largest empty rectangle on a plot.
+}
+\usage{
+ maxEmptyRect(ax,ay,x,y)
+}
+\arguments{
+ \item{ax,ay}{The rectangle within which all of the points are contained.
+  Usually the limits of a plot.}
+ \item{x,y}{x and y positions of the points.}
+}
+\details{
+ \samp{maxEmptyRect} searches the pairs of points on the plot to find
+ the largest rectangular space within which none of the points lie.
+ It does not guarantee that the space will be large enough to fit a
+ legend or text.
+ 
+ Two alternatives are the \samp{largest.empty} function in the 
+ \pkg{Hmisc} package and the \samp{emptyspace} function. \samp{maxEmptyRect}
+ appears to outperform \samp{emptyspace}, particularly in running time.
+ However, \samp{emptyspace} will sometimes find a "squarer" rectangle when 
+ \samp{maxEmptyRect} finds a slightly larger narrow rectangle.
+}
+\value{
+ A list containing the area of the rectangle and the coordinates of the
+ lower left and upper right corners (as used in \samp{rect}) of the rectangle
+ found.
+}
+\author{Hans Borchers}
+\references{
+ A. Naamad, D. T. Lee, and W.-L. Hsu (1984). On the Maximum Empty
+ Rectangle Problem. Discrete Applied Mathematics, 8: 267-277.
+}
+\examples{
+ x<-runif(100)
+ y<-runif(100)
+ plot(x,y,main="Find the maximum empty rectangle",xlab="X",ylab="Y")
+ mer<-maxEmptyRect(c(0,1),c(0,1),x,y)
+ rect(mer$rect[1],mer$rect[2],mer$rect[3],mer$rect[4],border="red")
+}
+\keyword{misc}
diff --git a/man/mtext3d.Rd b/man/mtext3d.Rd
new file mode 100755
index 0000000..66f1509
--- /dev/null
+++ b/man/mtext3d.Rd
@@ -0,0 +1,21 @@
+\name{mtext3d}
+\alias{mtext3d}
+\title{ Display text in the margins of a 3D plot }
+\description{
+ Display text in the margins of a 3D plot.
+}
+\usage{
+ mtext3d(edge,pmat,labels=TRUE,at=NULL,dist=0.3,xpd=NA,...)
+}
+\arguments{
+ \item{edge}{ which axis to calculate.}
+ \item{pmat}{ matrix to transform coordinates. }
+ \item{labels}{ labels to display in the margin. }
+ \item{at}{ position on the axis. }
+ \item{dist}{ Offset of the axis. }
+ \item{xpd}{ set clipping for display. }
+ \item{...}{ additional arguments passed to ptext3d. }
+}
+\value{nil}
+\author{Ben Bolker}
+\keyword{misc}
diff --git a/man/multhist.Rd b/man/multhist.Rd
new file mode 100755
index 0000000..63b07cc
--- /dev/null
+++ b/man/multhist.Rd
@@ -0,0 +1,40 @@
+\name{multhist}
+\alias{multhist}
+\title{Plot a multiple histogram, as a barplot}
+\description{
+ Given a list, plots a side-by-side barplot containing the histograms
+ of the elements
+}
+\usage{
+ multhist(x,beside=TRUE,freq=NULL,probability=!freq,plot.it=TRUE,...)
+}
+\arguments{
+ \item{x}{a list of numeric vectors}
+ \item{beside}{plot histogram bars for groups side-by-side?}
+ \item{freq}{logical; if 'TRUE', the histogram graphic is a representation
+             of frequencies, the 'counts' component of the result; if
+             'FALSE', probability densities, component 'density', are
+             plotted (so that the histogram has a total area of one).
+             Defaults to 'TRUE' if 'probability' is not specified
+             (does not consider equidistant breaks as in \link{hist})}
+ \item{probability}{an alias for '!freq', for S compatibility}
+ \item{plot.it}{Whether or not to display the histogram.}
+ \item{...}{additional arguments to \link{hist} or \link{barplot}}
+}
+\value{
+ A list including the return value for the first call to \samp{hist} (itself a list)
+ and the values for the bar heights.
+}
+\author{Ben Bolker}
+\seealso{\link{hist},\link{barplot}}
+\note{
+ The 'inside' argument to \link{barplot} (which is not currently
+  implemented in barplot anyway) is deleted from the argument list. The
+  default value of NULL for \samp{freq} is for consistency with \samp{hist}
+  but is equivalent to TRUE.
+}
+\examples{
+ l <- list(runif(10)*10,1:10,c(1,1,1,1,4,8))
+ multhist(l)
+}
+\keyword{hplot}
diff --git a/man/multsymbolbox.Rd b/man/multsymbolbox.Rd
new file mode 100755
index 0000000..288e49f
--- /dev/null
+++ b/man/multsymbolbox.Rd
@@ -0,0 +1,33 @@
+\name{multsymbolbox}
+\alias{multsymbolbox}
+\title{Draw boxes filled with symbols}
+\description{
+ Draw boxes on the current figure filled with symbols representing
+ individual counts.
+}
+\usage{
+ multsymbolbox(x1,y1,x2,y2,tot,relw=0.8,fg=par("fg"),bg=par("bg"),
+  box=TRUE,debug=FALSE,...)
+}
+\arguments{
+ \item{x1}{numeric vector: left sides of boxes}
+ \item{y1}{numeric vector: bottom sides of boxes}
+ \item{x2}{numeric vector: right sides of boxes}
+ \item{y2}{numeric vector: top sides of boxes}
+ \item{tot}{numeric vector: total numbers of symbols to put in each box}
+ \item{relw}{relative width (relative to height) of symbols}n
+ \item{fg}{foreground color(s)}
+ \item{bg}{background color(s)}
+ \item{box}{(logical) draw box borders?}
+ \item{debug}{debug output?}
+ \item{\dots}{additional arguments to polygon() for drawing boxes}
+}
+\value{
+ none
+}
+\author{Ben Bolker}
+\examples{
+ plot(1:10,1:10,type="n")
+ multsymbolbox(c(2,4),5,c(4,5),8,tot=c(10,8))
+}
+\keyword{aplot}
diff --git a/man/oz.windrose.Rd b/man/oz.windrose.Rd
new file mode 100755
index 0000000..3b02afc
--- /dev/null
+++ b/man/oz.windrose.Rd
@@ -0,0 +1,50 @@
+\name{oz.windrose}
+\alias{oz.windrose}
+\title{Display an Australian wind rose}
+\description{Displays a wind rose in the style used by the Australian
+ Bureau of Meteorology.}
+\usage{
+ oz.windrose(windagg,maxpct=20,wrmar=c(4,5,6,5),scale.factor=30,
+  speed.col=c("#dab286","#fe9a66","#ce6733","#986434"),
+  speed.width=NA,show.legend=TRUE,legend.pos=NA,...)
+}
+\arguments{
+ \item{windagg}{A matrix of percentages with the rows representing
+  speed ranges and the columns indicating wind directions.}
+ \item{maxpct}{The maximum percentage displayed on the radial grid.}
+ \item{wrmar}{Plot margins for the diagram.}
+ \item{scale.factor}{The scale factor for the diagram.}
+ \item{speed.col}{Colors representing speed ranges.}
+ \item{speed.width}{Half widths of the bars representing speed ranges.}
+ \item{show.legend}{Logical indicating whether to display a legend.}
+ \item{legend.pos}{The vertical position of the wind rose legend. The
+  Australian Bureau of Meteorology displays the legend at the top of
+  the plot}
+ \item{...}{additional arguments passed to \samp{plot}.}
+}
+\details{
+ \samp{oz.windrose} displays a wind rose in the style used by the Australian
+  Bureau of Meteorology. Each limb represents a bin of wind directions, and 
+  there are conventionally eight bins. If \samp{windagg} has more than eight
+  columns, more limbs will be displayed. The rows of \samp{windagg} represent
+  the speed ranges used by the Australian Bureau of Meteorology (0, 0-10, 
+  10-20, 20-30 and over 30 in km/hour). The diameter of the central circle is
+  calculated as (percent calm observations)/(number of direction bins). The
+  remaining grid circles are spaced from the circumference of the "Calm"
+  circle.
+}
+\note{
+ If a title is desired, remember to move the legend to the bottom 
+  of the plot. If the function is passed values that do not sum to 100, the
+  resulting plot will at best be misleading.
+}
+\value{nil}
+\author{Jim Lemon (thanks to Anna in the Sydney BoM office and Alejo for
+ finding the problem with heavily prevailing winds.)}
+\seealso{\link{oz.windrose.legend}, \link{draw.circle}, \link{bin.wind.records}}
+\examples{
+ windagg<-matrix(c(8,0,0,0,0,0,0,0,4,6,2,1,6,3,0,4,2,8,5,3,5,2,1,1,
+  5,5,2,4,1,4,1,2,1,2,4,0,3,1,3,1),nrow=5,byrow=TRUE)
+ oz.windrose(windagg)
+}
+\keyword{misc}
diff --git a/man/oz.windrose.legend.Rd b/man/oz.windrose.legend.Rd
new file mode 100755
index 0000000..2475a37
--- /dev/null
+++ b/man/oz.windrose.legend.Rd
@@ -0,0 +1,31 @@
+\name{oz.windrose.legend}
+\alias{oz.windrose.legend}
+\title{Display an Australian wind rose legend}
+\description{
+ Displays a wind rose legend in the style used by the Australian Bureau 
+ of Meteorology.
+}
+\usage{
+ oz.windrose.legend(maxpct=20,scale.factor=30,
+  speed.col=c("#dab286","#fe9a66","#ce6733","#986434"),
+  speed.width=NA,legend.pos=NA)
+}
+\arguments{
+ \item{maxpct}{The maximum percentage to display on the radial grid.}
+ \item{scale.factor}{The scale factor for the plot.}
+ \item{speed.col}{Colors representing speed ranges.}
+ \item{speed.width}{Half widths of the bars representing speed ranges.}
+ \item{legend.pos}{The vertical position of the wind rose legend. The
+  Australian Bureau of Meteorology displays the legend at the top of
+  the plot}
+}
+\value{nil}
+\author{Jim Lemon (thanks to Anna in the Sydney BoM office)}
+\seealso{\link{oz.windrose}}
+\examples{
+ plot(0,xlim=c(-20,20),ylim=c(-20,20),type="n",axes=FALSE,xlab="",ylab="")
+ par(xpd=TRUE)
+ oz.windrose.legend()
+ par(xpd=FALSE)
+}
+\keyword{misc}
diff --git a/man/p2p_arrows.Rd b/man/p2p_arrows.Rd
new file mode 100644
index 0000000..77c2f25
--- /dev/null
+++ b/man/p2p_arrows.Rd
@@ -0,0 +1,26 @@
+\name{p2p_arrows}
+\alias{p2p_arrows}
+\title{Draw arrows between points}
+\description{Displays arrows on an existing plot between specified
+ points.}
+\usage{
+ p2p_arrows(x1,y1,x2,y2,space=0.05,col=par("fg"),...)
+}
+\arguments{
+ \item{x1}{Starting x positions for the labels.}
+ \item{y1}{Starting y positions for the labels.}
+ \item{x2}{Ending x positions for the labels.}
+ \item{y2}{Ending y positions for the labels.}
+ \item{space}{The proportion of the distance between the points to
+  leave as space before and after the arrow.}
+ \item{col}{Color(s) for the arrows.}
+ \item{...}{Extra arguments passed to \samp{arrows}.}
+}
+\details{
+ \samp{p2p_arrows} displays arrows on a plot between one or more pairs
+ of specified points.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{arrows}}
+\keyword{misc}
diff --git a/man/panes.Rd b/man/panes.Rd
new file mode 100755
index 0000000..f029156
--- /dev/null
+++ b/man/panes.Rd
@@ -0,0 +1,86 @@
+\name{panes}
+\alias{panes}
+\title{Prepare a "panel" type layout}
+\description{
+ Split the graphics device into a "panel" type layout for a group of plots
+}
+\usage{
+ panes(mat=NULL,widths=rep(1,ncol(mat)),heights=rep(1,nrow(mat)),
+  nrow=2,ncol=2,mar=c(0,0,1.6,0),oma=c(2.5,1,1,1))
+}
+\arguments{
+ \item{mat}{A matrix representing the number of panes to be created and
+  their order of plotting.}
+ \item{widths,heights}{The widths and heights of the panes.
+  See \samp{layout}.}
+ \item{nrow,ncol}{The numbers of rows and columns in the layout.
+  See \samp{par(mfrow)}.}
+ \item{mar}{The margins for each plot in the panes.}
+ \item{oma}{The outer margins for the entire group of panes.}
+}
+\details{
+ \samp{panes} combines the information for displaying a set of plots in
+ a "panel" layout. The default values will usually produce the desired
+ result by calling \samp{par(mfrow)}. If \samp{mat} is not NULL, the
+ \samp{layout} function will be called instead of \samp{par(mfrow)}.
+ The two methods are included for the convenience of the user.
+
+ Note that \samp{panes} does not produce any plots and that the user
+ must call \samp{tab.title} to get the "look" of the panel plot. The
+ overall title is usually centered at the left edge (as in the example)
+ or in the center of one of the plots in the bottom row.
+}
+\value{
+ The values of \samp{par} options that existed when \samp{panes} was
+ called. This list is usually used to restore those values.
+}
+\author{Jim Lemon}
+\seealso{\link{par},\link{layout}}
+\examples{
+ y<-runif(8)
+ oldpar<-panes(matrix(1:4,nrow=2,byrow=TRUE))
+ par(mar=c(0,2,1.6,0))
+ boxplot(y,axes=FALSE)
+ axis(2)
+ box()
+ par(mar=c(0,0,1.6,2))
+ tab.title("Boxplot of y",tab.col="#88dd88")
+ barplot(y,axes=FALSE,col=2:9)
+ axis(4)
+ box()
+ tab.title("Barplot of y",tab.col="#88dd88")
+ par(mar=c(2,2,1.6,0))
+ pie(y,col=2:9)
+ tab.title("Pie chart of y",tab.col="#88dd88")
+ box()
+ par(mar=c(2,0,1.6,2))
+ plot(y,xaxs="i",xlim=c(0,9),axes=FALSE,col=2:9)
+ axis(4)
+ box()
+ tab.title("Scatterplot of y",tab.col="#88dd88")
+ # center the title at the left edge of the last plot
+ mtext("Test of panes function",at=0,side=1,line=0.8,cex=1.5)
+ panes(matrix(1:3,ncol=1),heights=c(0.7,0.8,1))
+ par(mar=c(0,2,2,2))
+ plot(sort(runif(7)),type="l",axes=FALSE)
+ axis(2,at=seq(0.1,0.9,by=0.2))
+ box()
+ tab.title("Rising expectations",tab.col="#ee6666")
+ barplot(rev(sort(runif(7))),col="blue",axes=FALSE)
+ axis(2,at=seq(0.1,0.9,by=0.2))
+ box()
+ tab.title("Diminishing returns",tab.col="#6666ee")
+ par(mar=c(4,2,2,2))
+ tso<-c(0.2,0.3,0.5,0.4,0.6,0.8,0.1)
+ plot(tso,type="n",axes=FALSE,xlab="")
+ # the following needs a Unicode locale to work
+ points(1:7,tso,pch=c(rep(-0x263a,6),-0x2639),cex=2)
+ axis(1,at=1:7,
+  labels=c("Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday","Monday"))
+ axis(2,at=seq(0.1,0.9,by=0.2))
+ box()
+ tab.title("The sad outcome",tab.col="#66ee66")
+ mtext("A lot of malarkey",side=1,line=2.5)
+ par(oldpar)
+}
+\keyword{misc}
diff --git a/man/pasteCols.Rd b/man/pasteCols.Rd
new file mode 100755
index 0000000..448731d
--- /dev/null
+++ b/man/pasteCols.Rd
@@ -0,0 +1,28 @@
+\name{pasteCols}
+\alias{pasteCols}
+\title{Paste the columns of a matrix together}
+\description{Paste the columns of a matrix together to form as
+ many "words" as there are columns.}
+\usage{
+ pasteCols(x,sep="")
+}
+\arguments{
+ \item{x}{A matrix.}
+ \item{sep}{The separator to use in the \samp{paste} command.}
+}
+\details{
+ \samp{pasteCols} pastes the columns of a matrix together to form a vector in
+ which each element is the concatenation of the elements in each of the columns
+ of the matrix. It is intended for producing identifiers from a matrix returned
+ by the \samp{combn} function.
+}
+\value{A vector of character strings.}
+\keyword{misc}
+\author{Jim Lemon}
+\seealso{\link{makeIntersectList}}
+\examples{
+ # create a matrix of the combinations of the first five letters of the
+ # alphabet taken two at a time.
+ alpha5<-combn(LETTERS[1:5],2,simplify=TRUE)
+ pasteCols(alpha5,sep="+")
+}
diff --git a/man/paxis3d.Rd b/man/paxis3d.Rd
new file mode 100755
index 0000000..befcd2a
--- /dev/null
+++ b/man/paxis3d.Rd
@@ -0,0 +1,44 @@
+\name{paxis3d}
+\alias{paxis3d}
+\title{ Display text in the margins of a 3D plot }
+\description{
+ Display text in the margins of a 3D plot.
+}
+\usage{
+ paxis3d(edge,pmat,at=NULL,labels=TRUE,tick=TRUE,
+  pos=NULL,nticks=5,ticklen=0.05,labdist=0.15,xpd=NA,...)
+}
+\arguments{
+ \item{edge}{ which axis to calculate.}
+ \item{pmat}{ matrix to transform coordinates. }
+ \item{at}{ position on the axis. }
+ \item{labels}{ labels to display in the margin. }
+ \item{tick}{ whether to draw axis tick marks. }
+ \item{pos}{ axis position relative to other axes. }
+ \item{nticks}{ number of tick marks. }
+ \item{ticklen}{ length of tick marks as a proportion of plot dimensions. }
+ \item{labdist}{ distance of labels from axis. }
+ \item{xpd}{ parameter to set plot clipping. }
+ \item{...}{ additional arguments passed to ptext3d. }
+}
+\value{nil}
+\author{Ben Bolker}
+\examples{
+ x <- 1:10
+ y <- 1:10
+ z <- outer(x,y,function(x,y) { 3*sin(2*pi*x)/(2*pi*x)+exp(y/10)+(x*y)/1000 })
+ par(mar=c(5,10,2,2))
+ pp <- perspx(x,y,z,ticktype="detailed",phi=30,theta=80,nticks=3,r=10,
+      axes=FALSE)
+ ## axis labels not drawn when axes=FALSE
+ paxis3d("X-",pp,at=c(1,2,9))
+ paxis3d("Y+",pp)
+ paxis3d("Z-",pp)
+ mtext3d("X-",pp,expression(alpha^sqrt(beta)))
+ ## if you want labels parallel to axis, still have to figure out 'srt'
+ ##   by trial and error
+ mtext3d("Y+",pp,expression("velocity ("*gamma*", furlongs/fortnight)"),
+        xpd=NA,srt=6)
+ mtext3d("Z-",pp,"Range\n(r*)",dist=0.5)
+}
+\keyword{misc}
diff --git a/man/perspx.Rd b/man/perspx.Rd
new file mode 100755
index 0000000..264024b
--- /dev/null
+++ b/man/perspx.Rd
@@ -0,0 +1,29 @@
+\name{perspx}
+\alias{perspx}
+\title{ Display perspective plot }
+\description{
+ Display an enhanced perspective plot with additional return values
+}
+\usage{
+ perspx(x,y,z,...)
+}
+\arguments{
+  \item{x,y,z}{ x, y and z coordinates to plot. }
+  \item{...}{ Other arguments passed to \samp{persp}. }
+}
+\details{
+ Displays \samp{z} values plotted on an x,y grid.
+}
+\value{
+  A list with three elements, the ranges of \samp{x}, \samp{y} and \samp{z}.
+}
+\author{Ben Bolker}
+\examples{
+ x <- 1:10
+ y <- 1:10
+ z <- outer(x,y,function(x,y) { 3*sin(2*pi*x)/(2*pi*x)+exp(y/10)+(x*y)/1000 })
+ par(mar=c(5,10,2,2))
+ pp <- perspx(x,y,z,ticktype="detailed",phi=30,theta=80,nticks=3,r=10,
+  axes=FALSE)
+}
+\keyword{misc}
diff --git a/man/pie.labels.Rd b/man/pie.labels.Rd
new file mode 100755
index 0000000..b801693
--- /dev/null
+++ b/man/pie.labels.Rd
@@ -0,0 +1,51 @@
+\name{pie.labels}
+\alias{pie.labels}
+\title{ Place labels on a pie chart }
+\description{
+ Places labels on a pie chart
+}
+\usage{
+ pie.labels(x,y,angles,labels,radius=1.05,bg="white",border=TRUE,
+  minangle=NA,boxed=FALSE,...)
+}
+\arguments{
+ \item{x,y}{x and y position of the center of the pie chart}
+ \item{angles}{A numeric vector representing angles in radians. This is
+  the return value of \samp{floating.pie}.}
+ \item{labels}{Text strings to label each sector.}
+ \item{radius}{The radius at which to place the labels in user units. The
+  default is 1.05.}
+ \item{bg}{The color of the rectangles on which the labels are displayed.}
+ \item{border}{Whether to draw borders around the rectangles.}
+ \item{minangle}{Minimum angle between labels.}
+ \item{boxed}{Whether to use \samp{text} or \samp{boxed.labels} to display
+  the labels.}
+ \item{...}{Arguments passed to \samp{text} or \samp{boxed.labels}.}
+}
+\value{nil}
+\details{
+ Labels may be placed within the pie (radius less than the pie radius),
+ on the edge or outside as in the examples below. If within the pie, it
+ is probably best to use \samp{boxed=TRUE}.
+
+ If some labels overlap, passing a value in radians for \samp{minangle}
+ may be used to spread them out.
+}
+\note{
+ Remember that \samp{x} and \samp{y} specify the center of the pie chart and
+ that the label positions are specified by angles and radii from that 
+ center.
+}
+\author{Jim Lemon}
+\seealso{\link{floating.pie}, \link{boxed.labels}, \link{spreadout}}
+\examples{
+ pieval<-c(2,1,3,94)
+ plot(1:5,type="n",axes=FALSE,xlab="",ylab="")
+ box()
+ bisect.angles<-floating.pie(3,3,pieval)
+ pie.labels(3,3,bisect.angles,c("two","one","three","ninety\nfour"))
+ pie.labels(3,3,bisect.angles,radius=1.5,
+  c("First\nvalue","Second\nvalue","Third\nvalue","Fourth\nvalue"),
+  minangle=0.2,boxed=TRUE)
+}
+\keyword{misc}
diff --git a/man/pie3D.Rd b/man/pie3D.Rd
new file mode 100755
index 0000000..db8d480
--- /dev/null
+++ b/man/pie3D.Rd
@@ -0,0 +1,87 @@
+\name{pie3D}
+\alias{pie3D}
+\title{Display a 3D pie chart}
+\description{
+ Displays a 3D pie chart with optional labels.
+}
+\usage{
+ pie3D(x,edges=NA,radius=1,height=0.1,theta=pi/6,start=0,border=par("fg"),
+  col=NULL,labels=NULL,labelpos=NULL,labelcol=par("fg"),labelcex=1.5,
+  sector.order=NULL,explode=0,shade=0.8,mar=c(4,4,4,4),pty="s",...)
+}
+\arguments{
+ \item{x}{a numeric vector for which each value will be a sector}
+ \item{edges}{the number of lines forming an ellipse}
+ \item{radius}{the radius of the pie in user units}
+ \item{height}{the height of the pie in user units}
+ \item{theta}{The angle of viewing in radians}
+ \item{start}{The angle at which to start drawing sectors.}
+ \item{border}{The color of the sector border lines}
+ \item{col}{The colors of the sectors}
+ \item{labels}{Optional labels for each sector}
+ \item{labelpos}{Optional positions for the labels (see examples)}
+ \item{labelcol}{The color of the labels}
+ \item{labelcex}{The character expansion factor for the labels}
+ \item{sector.order}{Allows the operator to specify the order in
+  which the sectors are drawn.}
+ \item{explode}{The amount to "explode" the pie in user units}
+ \item{shade}{If > 0 and < 1, the proportion to reduce the
+  brightness of the sector color to get a better 3D effect.}
+ \item{mar}{Margins around the pie.}
+ \item{pty}{Whether to force a square plot region or not. (see Details)}
+ \item{...}{graphical parameters passed to \samp{plot}}
+}
+\value{
+ The bisecting angle of the sectors in radians.
+}
+\details{
+ \samp{pie3D} scales the values in \samp{x} so that they total 2*pi,
+ dropping zeros and NAs. It then displays an empty plot, calculates
+ the sequence for drawing the sectors and calls \samp{draw.tilted.sector}
+ to draw each sector. If labels are supplied, it will call \samp{pie3D.label}
+ to place these outside each sector. If supplied, the number of labels, label 
+ positions and sector colors must be at least equal to the number of values 
+ in \samp{x}. If the labels are long, it may help to reduce the radius of
+ the pie or change the position as in the example below.
+
+ In order to make the dimensions of the pie reasonably accurate, a square plot
+ region (\samp{pty="s"}) is the default. If \samp{pty} is set to "m", the user
+ can change the margins, usually resulting in a non-square plot area. This will
+ probably distort the pie somewhat.
+}
+\note{
+ Due to the somewhat primitive method used to draw sectors, a sector that
+ extends beyond both pi/2 and 3*pi/2 radians in either direction may not
+ display properly. Setting \samp{start} to pi/2 will often fix this, but
+ the user may have to adjust \samp{start} and the order of sectors in extreme
+ cases. The argument \samp{sector.order} allows the user to specify a vector
+ of integers that will override the calculation of the order in which the
+ sectors are drawn. This is usually necessary when a very large sector that 
+ extends past 3*pi/2 is overlapped by a smaller sector next to it. As a last
+ resort, the user can try setting \samp{explode} to zero. This only draws
+ the top and outer sides of each sector.
+ 
+ Also due to the sector drawing method, setting \samp{theta} to values smaller
+ than about pi/8 or larger than about pi/4 will produce obviously misaligned
+ sectors.
+
+ Contributed fixes and improvements:
+ thanks to Jesse Brown for the "shade" fix and Qinghua Zhao for alerting me to
+ the problem with labels and margins
+}
+\author{Jim Lemon}
+\seealso{\link{pie3D.labels}, \link{draw.tilted.sector}}
+\examples{
+ pieval<-c(2,4,6,8)
+ pielabels<-
+  c("We hate\n pies","We oppose\n  pies","We don't\n  care","We just love pies")
+ # grab the radial positions of the labels
+ lp<-pie3D(pieval,radius=0.9,labels=pielabels,explode=0.1,main="3D PIE OPINIONS")
+ # lengthen the last label and move it to the left
+ pielabels[4]<-"We cannot survive without our pies"
+ lp[4]<-4.8
+ # specify some new colors
+ pie3D(pieval,radius=0.9,labels=pielabels,explode=0.1,main="3D PIE OPINIONS",
+  col=c("brown","#ddaa00","pink","#dd00dd"),labelpos=lp)
+}
+\keyword{misc}
diff --git a/man/pie3D.labels.Rd b/man/pie3D.labels.Rd
new file mode 100755
index 0000000..904d334
--- /dev/null
+++ b/man/pie3D.labels.Rd
@@ -0,0 +1,46 @@
+\name{pie3D.labels}
+\alias{pie3D.labels}
+\title{Display labels on a 3D pie chart}
+\description{
+ Displays labels on a 3D pie chart.
+}
+\usage{
+ pie3D.labels(radialpos,radius=1,height=0.1,theta=pi/6,
+  labels,labelcol=par("fg"),labelcex=1.5,labelrad=1.25,minsep=0.3)
+}
+\arguments{
+ \item{radialpos}{Position of the label in radians}
+ \item{radius}{the radius of the pie in user units}
+ \item{height}{the height of the pie in user units}
+ \item{theta}{The angle of viewing in radians}
+ \item{labels}{The label to display}
+ \item{labelcol}{The color of the labels}
+ \item{labelcex}{The character expansion factor for the labels}
+ \item{labelrad}{The expansion for the labels around the pie.}
+ \item{minsep}{The minimum angular separation between label positions.}
+}
+\value{
+ nil
+}
+\details{
+ \samp{pie3D.label} displays labels on a 3D pie chart. The positions
+ of the labels are given as angles in radians (usually the bisector of the
+ pie sectors). As the labels can be passed directly to \link{pie3D},
+ this function would probably not be called by the user.
+ 
+ \samp{pie3D.labels} tries to separate labels that are placed closer than
+ \samp{minsep} radians. This simple system will handle minor crowding of
+ labels. If labels are very crowded, capturing the return value of 
+ \samp{pie3D} and editing the label positions may allow the user to avoid
+ manually placing labels.
+}
+\author{Jim Lemon}
+\seealso{\link{pie3D}, \link{draw.tilted.sector}}
+\examples{
+ pieval<-c(2,4,6,8)
+ bisectors<-pie3D(pieval,explode=0.1,main="3D PIE OPINIONS")
+ pielabels<-
+  c("We hate\n pies","We oppose\n  pies","We don't\n  care","We just love pies")
+ pie3D.labels(bisectors,labels=pielabels)
+}
+\keyword{misc}
diff --git a/man/placeLabels.Rd b/man/placeLabels.Rd
new file mode 100644
index 0000000..8e230c7
--- /dev/null
+++ b/man/placeLabels.Rd
@@ -0,0 +1,54 @@
+\name{placeLabels}
+\alias{placeLabels}
+\title{ Place labels in boxes }
+\description{
+ Places labels in boxes on an existing plot
+}
+\usage{
+ placeLabels(x,y=NA,labels,pointer=TRUE,cex=1,labelcol=par("fg"),
+ labelbg="white",border=par("fg"),pointercol=par("fg"),
+ pch=1,col=1,bg="white",flagcol="red")
+}
+\arguments{
+ \item{x,y}{x and y position of the centers of the labels. \samp{x} can be an
+  \link{xy.coords} list.}
+ \item{labels}{Text strings}
+ \item{pointer}{Whether to draw a line segment from the label to the 
+  points labeled.}
+ \item{cex}{Character expansion. See \samp{text}.}
+ \item{labelcol}{The color(s) of the text in the labels.}
+ \item{labelbg}{The background color(s) for the labels.}
+ \item{border}{The color(s) for the borders around the rectangles.}
+ \item{pointercol}{The color(s) of the pointer lines.}
+ \item{pch}{The symbol(s) to use when redisplaying the original points 
+  (see Details).}
+ \item{col}{The color(s) of the original points.}
+ \item{bg}{The background color(s) of the original points.}
+ \item{flagcol}{The color to use for "flagging" each point.}
+}
+\details{
+ \samp{placeLabels} steps through the points indexed by \samp{x} and
+ \samp{y}, allowing the operator to manually place the labels for each 
+ point. Each point is "flagged" by displaying a small colored circle (red
+ by default). When the label for that point has been placed, the original
+ symbol is displayed and the next point is flagged.
+ 
+ Each point and label can have different colors and backgrounds.
+}
+\note{
+ This function is handy for one-off plots with a moderate number of 
+ points. It can be very useful for plots with clumps of points.
+}
+\value{nil - adds labels to an existing plot.}
+\author{Jim Lemon - thanks to Marna Wagley for the idea.}
+\seealso{\link{spread.labels}, \link{thigmophobe.labels}}
+\examples{
+ # won't check because of the call to locator
+ \dontrun{
+  x<-rnorm(10)
+  y<-rnorm(10)
+  plot(x,y)
+  placeLabels(x,y,LETTERS[1:10],flagcol="purple")
+ }
+}
+\keyword{misc}
diff --git a/man/plot.dendrite.Rd b/man/plot.dendrite.Rd
new file mode 100755
index 0000000..4471597
--- /dev/null
+++ b/man/plot.dendrite.Rd
@@ -0,0 +1,43 @@
+\name{plot.dendrite}
+\alias{plot.dendrite}
+\title{Plot a dendrogram of a dendrite object}
+\description{Plot a dendrogram for two or more mutually exclusive attributes.}
+\usage{
+ \method{plot}{dendrite}(x,xlabels=NULL,main="",mar=c(1,0,3,0),cex=1,
+  col="white",...)
+}
+\arguments{
+ \item{x}{A \samp{dendrite} object containing the counts of objects having
+  combinations of mutually exclusive attributes.}
+ \item{xlabels}{The category labels that will be displayed beneath the
+  dendrogram.}
+ \item{main}{The title of the plot.}
+ \item{mar}{Margins for the plot.}
+ \item{cex}{Character expansion for the leaves of the dendrogram.}
+ \item{col}{Background colors for the boxes (see Details).}
+ \item{...}{Additional arguments passed to \samp{plot}.}
+}
+\details{  
+ \samp{plot.dendrite} sets up a plot for a dendrogram. The actual plotting of
+ the dendrogram is done by \samp{furc}.
+ 
+ If samp{col} is a vector of colors as long as the number of category labels,
+ each category label will be displayed in a different colored box. This may 
+ may cause problems when different category labels are used at each level
+ with common names, as the color for a name will be the same at all levels.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{furc}}
+\examples{
+ sex<-sample(c("M","F"),100,TRUE)
+ hair<-c(sample(c("Blond","Black","Brown","Red"),90,TRUE),rep(NA,10))
+ eye<-sample(c("Blue","Black","Brown","Green"),100,TRUE)
+ charac<-data.frame(sex=sex,hair=hair,eye=eye)
+ characlist<-makeDendrite(charac)
+ shecol<-c(Black="black",Blond="yellow",Blue="blue",Brown="brown",
+  F="pink",Green="green",M="lightblue","NA"="gray",Red="orange")
+ plot.dendrite(characlist,names(charac),main="Test dendrogram",
+  col=shecol)
+}
+\keyword{misc}
diff --git a/man/plotCI.Rd b/man/plotCI.Rd
new file mode 100755
index 0000000..8d75ff6
--- /dev/null
+++ b/man/plotCI.Rd
@@ -0,0 +1,77 @@
+\name{plotCI}
+\alias{plotCI}
+\title{Plot confidence intervals/error bars}
+\description{
+ Given a set of x and y values and upper and lower bounds,
+  this function plots the points with error bars.
+}
+\usage{
+ plotCI(x,y=NULL,uiw,liw=uiw,ui=NULL,li=NULL,err="y",
+  sfrac=0.01,gap=0,slty=par("lty"),add=FALSE,scol=NULL,pt.bg=par("bg"),...)
+}
+\arguments{
+ \item{x}{The x coordinates of points in the plot}
+ \item{y}{The y coordinates of points in the plot}
+ \item{uiw}{The width of the upper portion of the confidence region,
+  or (if \samp{liw} is missing) the width of both halves of
+  the confidence region}
+ \item{liw}{The width of the lower portion of the confidence region (if
+  missing, the function assumes symmetric confidence bounds)}
+ \item{ui}{The absolute upper limit of the confidence region}
+ \item{li}{The absolute lower limit of the confidence region}
+ \item{err}{The direction of error bars: "x" for horizontal, "y"
+  for vertical ("xy" would be nice but is not implemented yet; don't
+  know quite how everything would be specified.  See examples for
+  composing a plot with simultaneous horizontal and vertical error bars)}
+ \item{gap}{Size of gap in error bars around points
+  (default 0;gap=TRUE gives gap size of 0.01)}
+ \item{sfrac}{Scaling factor for the size of the "serifs" (end bars) on
+  the confidence bars, in x-axis units}
+ \item{add}{If FALSE (default), create a new plot; if TRUE, add error
+  bars to an existing plot.}
+ \item{slty}{Line type of error bars}
+ \item{scol}{Color of error bars: if \samp{col} is specified in the
+  optional arguments, \samp{scol} is set the same; otherwise it's set
+  to \samp{par(col)}}
+ \item{pt.bg}{Background color of points (use pch=21, pt.bg=par("bg")
+  to get open points superimposed on error bars)}
+ \item{\dots}{Any other parameters to be passed through to
+  \link{plot.default}, \link{points},
+  \link{arrows}, etc. (e.g. \samp{lwd}, \samp{col}, \samp{pch},
+  \samp{axes}, \samp{xlim}, \samp{ylim}).  \samp{xlim} and
+  \samp{ylim} are set by default to include all of the data points and
+  error bars.  \samp{xlab} and \samp{ylab} are set to the names of
+  \samp{x} and \samp{y}.  If \samp{pch==NA}, no points are drawn
+  (e.g. leaving room for text labels instead)}
+}
+\value{
+ invisible(x,y); creates a plot on the current device.
+}
+\author{Ben Bolker (documentation and tweaking of a function provided by
+  Bill Venables, additional feature ideas from Gregory Warnes)}
+\seealso{\link{boxplot}}
+\examples{
+ y<-runif(10)
+ err<-runif(10)
+ plotCI(1:10,y,err,main="Basic plotCI")
+ plotCI(1:10,y,err,2*err,lwd=2,col="red",scol="blue",
+  main="Add colors to the points and error bars")
+ err.x<-runif(10)
+ err.y<-runif(10)
+ plotCI(1:10,y,err.y,pt.bg=par("bg"),pch=21,xlim=c(0,11),
+  main="plotCI with extra space on the x axis")
+ plotCI(1:10,y,err.x,pt.bg=par("bg"),pch=21,err="x",add=TRUE)
+ mtext("for adding horizontal error bars",3,0.5)
+ data(warpbreaks)
+ attach(warpbreaks)
+ wmeans<-by(breaks,tension,mean)
+ wsd<-by(breaks,tension,sd)
+ ## note that barplot() returns the midpoints of the bars, which plotCI
+ ##  uses as x-coordinates
+ plotCI(barplot(wmeans,col="gray",ylim=c(0,max(wmeans+wsd))),wmeans,wsd,add=TRUE)
+ ## using labels instead of points
+ labs<-sample(LETTERS,replace=TRUE,size=10)
+ plotCI(1:10,y,err,pch=NA,gap=0.02,main="plotCI with labels at points")
+ text(1:10,y,labs)
+}
+\keyword{hplot}
diff --git a/man/plotH.Rd b/man/plotH.Rd
new file mode 100644
index 0000000..b3faca1
--- /dev/null
+++ b/man/plotH.Rd
@@ -0,0 +1,64 @@
+\name{plotH}
+\alias{plotH}
+\alias{plotH.formula}
+\alias{plotH.default}
+\title{Scatterplot with histogram-like bars.}
+\description{
+ Scatterplot with histogram-like bars; a modification of
+ \samp{plot(...,type="h")}.
+}
+\usage{
+ plotH(x,...)
+
+ \method{plotH}{formula}(x,data=NULL,xlab=names(mf)[2],ylab=names(mf)[1],...)
+
+ \method{plotH}{default}(x,y,xlab=paste(deparse(substitute(x))),
+  ylab=paste(deparse(substitute(y))),width=0.6,ylim=c(0,max(y)),col="gray",...)
+}
+\arguments{
+ \item{x}{Vector of x-coordinates or a formula of the form y~x
+  (see below for y).}
+ \item{y}{Vector of y-coordinates.}
+ \item{xlab}{A string for labeling the x-axis.}
+ \item{ylab}{A string for labeling the y-axis.}
+ \item{data}{The data frame from which the formula should be evaluated.}
+ \item{width}{A numeric that indicates the width of the bars.}
+ \item{ylim}{A vector of length two that indicates the limits over which to
+  plot the y-axis. See details.}
+ \item{col}{A string that indicates the fill color for the bars.}
+ \item{...}{Additional arguments sent to the \samp{plot} or \samp{barplot}
+  functions.}
+}
+\details{
+ \samp{plotH} is meant to be a modification of the type="h" version of
+ \samp{plot} such that the "bars" appears as actual rectangles rather than
+ vertical lines. It defaults so that the lower bound of the y-axis is 0;
+ change to \samp{ylim=NULL} to over-ride this default (and return to the
+ default used in \samp{plot}.
+ 
+ A pass-through to \samp{barplot} is used if the \samp{x} (or "RHS") variable
+ is categorical.
+}
+\value{None, but a plot is produced.}
+\note{This function is currently experimental.}
+\author{Derek Ogle}
+\seealso{\link{plot}, \link{barplot}}
+\examples{
+ d<-data.frame(x=c(1,5,10:20),y=runif(13)+1,
+  g=factor(sample(c("A","B","C"),13,replace=TRUE)))
+ # new plotH function with formula notation
+ plotH(y~x,data=d)
+ # old plot() function with formula notation -- for comparison's purpose
+ plot(y~x,data=d,type="h")
+ # new function over-riding default ylim, increasing bar width,
+ # and changing bar color
+ plotH(y~x,data=d,ylim=NULL,width=0.9,col="red")
+ # example of pass-through to barplot
+ smry<-by(d$y,d$g,mean)
+ plotH(levels(d$g),smry,ylab="Mean of Random Variable",xlab="Group")
+ # example of non-formula usage
+ x1 <- d$x
+ y1 <- d$y
+ plotH(x1,y1,col="blue")
+}
+\keyword{misc}
diff --git a/man/plot_bg.Rd b/man/plot_bg.Rd
new file mode 100644
index 0000000..4d2cf2d
--- /dev/null
+++ b/man/plot_bg.Rd
@@ -0,0 +1,18 @@
+\name{plot_bg}
+\alias{plot_bg}
+\title{ Add a background color to a plot }
+\description{Displays a colored rectangle over the entire area of a plot}
+\usage{plot_bg(col="lightgray")}
+\arguments{
+ \item{col}{The color of the background}
+}
+\details{
+ \samp{plot_bg} is probably only useful when part of the \samp{do.first}
+ argument in another plot function to add a background color to the plot.
+}
+\value{nil}
+\author{Jim Lemon}
+\examples{
+ barp(1:5,do.first="plot_bg()",col=1:5)
+}
+\keyword{misc}
diff --git a/man/plotrix-package.Rd b/man/plotrix-package.Rd
new file mode 100644
index 0000000..c60d41a
--- /dev/null
+++ b/man/plotrix-package.Rd
@@ -0,0 +1,63 @@
+\name{plotrix-package}
+\alias{plotrix-package}
+\alias{plotrix}
+\docType{package}
+\title{
+Specialized plots and plotting accessories
+}
+\description{
+A large number of specialized plots and accessory functions like color
+scaling, text placement and legends.
+}
+\details{
+\tabular{ll}{
+Package: \tab plotrix\cr
+Version: \tab 3.6-1\cr
+Date: \tab 2015-12-20\cr
+License: \tab GPL (>=2)\cr
+Packaged: \tab 2015-12-20 10:31:35 UTC; root\cr
+Built: \tab R 3.2.3; ; 2015-02-21 02:33:26 UTC; linux\cr
+}
+ The plotrix package is intended to provide a method for getting many sorts of
+ specialized plots quickly, yet allow easy customization of those plots
+ without learning a great deal of specialized syntax. There are three major
+ aims that can be represented as follows:
+
+Fast foods
+
+Think of plotrix as a graphics vending machine or fast graphics cafe. You walk
+ in, make your choice and get your lunch. It may not be exactly the lunch you
+ want, but you do get a pretty good lunch, fast. You can get junk food or
+ health food, you make the choice.
+
+Hot rods
+
+You can customize plotrix as much as you want. Like the ageing machinery that
+ is usually bolted into hot rods, the base graphics package is fairly easy to
+ understand. plotrix is modular. You can create a frame for your plot, then
+ you can add whatever bits you like to it instead of just taking the default
+ plot that is available. You can have wide wheels and chromed exhaust pipes if
+ you want.
+
+No black boxes
+
+If you want to go from pushing the fast food button to hot rodding, it's not
+ hard. The source code in the functions is written to be understood. If
+ something goes wrong, you can usually find where it happened right away and
+ work on it. This means that you can learn about how the functions do what
+ they do rather than just what they do. So that's how to write recursive
+ functions in R!
+
+Because plotrix encourages users to learn how it works, you usually begin to
+ do so pretty quickly. Users often decide to write their own versions of
+ plotrix functions and sometimes they contribute the results back into plotrix.
+ You may find that you like other graphics systems like grid or lattice better.
+ That's great, because one idea behind plotrix is that if you get into R and
+ can get things done quickly and easily, you'll stick with it and soon want to
+ get things done your way. 
+}
+\author{
+Jim Lemon <drjimlemon at gmail.com>, and many others
+Maintainer: Jim Lemon <drjimlemon at gmail.com>
+}
+\keyword{ package }
diff --git a/man/polar.plot.Rd b/man/polar.plot.Rd
new file mode 100755
index 0000000..a7199e1
--- /dev/null
+++ b/man/polar.plot.Rd
@@ -0,0 +1,47 @@
+\name{polar.plot}
+\title{Plot values on a circular grid of 0 to 360 degrees}
+\usage{
+ polar.plot(lengths,polar.pos=NULL,labels,label.pos=NULL,
+  start=0,clockwise=FALSE,rp.type="r",...)
+}
+\alias{polar.plot}
+\arguments{
+ \item{lengths}{numeric data vector. Magnitudes will be represented as
+  the radial positions of symbols, line ends or polygon vertices.}
+ \item{polar.pos}{numeric vector of positions on a 0:360 degree circle.
+  These will be converted to radians when passed to \samp{radial.plot}.}
+ \item{labels}{text labels to place on the periphery of the circle. This 
+  defaults to labels every 20 degrees. For no labels, pass an empty string.}
+ \item{label.pos}{positions of the peripheral labels in degrees}
+ \item{start}{The position for zero degrees on the plot in degrees.}
+ \item{clockwise}{Whether to increase angles clockwise rather than the
+  default counterclockwise.}
+ \item{rp.type}{Whether to plot radial lines, symbols or a polygon.}
+ \item{...}{additional arguments passed to \samp{radial.plot} and
+  then to \samp{plot}.}
+}
+\description{
+ \samp{polar.plot} displays a plot of radial lines, symbols or a polygon 
+  centered at the midpoint of the plot frame on a 0:360 circle.
+  Positions are interpreted as beginning at the right and moving
+  counterclockwise unless \samp{start} specifies another starting point or
+  \samp{clockwise} is TRUE.
+
+ If \samp{add=TRUE} is passed as one of the additional arguments, the values
+ will be added to the current plot. If a \samp{radial.lim} argument was
+ passed on the initial plot, it must be passed again to add values or the
+ values will be displayed incorrectly.
+}
+\value{A list of the parameters altered by \link{radial.plot}.}
+\author{Jim Lemon}
+\keyword{misc}
+\seealso{\link{radial.plot}}
+\examples{
+ testlen<-c(rnorm(36)*2+5)
+ testpos<-seq(0,350,by=10)
+ polar.plot(testlen,testpos,main="Test Polar Plot",lwd=3,line.col=4)
+ oldpar<-polar.plot(testlen,testpos,main="Test Clockwise Polar Plot",
+  radial.lim=c(0,15),start=90,clockwise=TRUE,lwd=3,line.col=4)
+ # reset everything
+ par(oldpar)
+}
diff --git a/man/polygon.shadow.Rd b/man/polygon.shadow.Rd
new file mode 100755
index 0000000..5dc1c4e
--- /dev/null
+++ b/man/polygon.shadow.Rd
@@ -0,0 +1,55 @@
+\name{polygon.shadow}
+\alias{polygon.shadow}
+\title{Display a shadow effect for an arbitrary polygon}
+\description{
+ Displays a shadow effect on an existing plot
+}
+\usage{
+ polygon.shadow(x,y=NULL,offset=NA,inflate=NA,col=c("#ffffff","#cccccc"))
+}
+\arguments{
+ \item{x,y}{x and y coordinate of the vertices of the polygon. \samp{y}
+  can be missing if \samp{x} is a list with \samp{x} and \samp{y} components.}
+ \item{offset}{a vector containing the values of the x and y offsets for the
+  shadow. Defaults to 1/20 of the maximum x and y dimensions of the polygon.}
+ \item{col}{the colors of the shadow from the outer edge to the central part.}
+ \item{inflate}{the amount to "inflate" the shadow relative to the polygon 
+  (i.e. the penumbra). Defaults to the values in \samp{offset}.}
+}
+\value{nil}
+\details{
+ \samp{polygon.shadow} is typically called just before drawing a polygon.
+ It displays a shadow effect by drawing the polygon ten times, beginning 
+ with the first color in \samp{col} and stepping through to the second
+ color to create a "shadow" (or a "halo" if you prefer). Each successive
+ polygon is shrunk by 10\% of \samp{inflate}. The default shadow effect has
+ the light at the upper left. This effect may also be used as a text
+ background.
+}
+\note{
+ The background must be a constant color or the shadow effect will not 
+ look right. A good starting point for the two colors is the color of the
+ background and the RGB components of that color multiplied by 0.8. Use a
+ smaller multiplier for a darker shadow.
+}
+\author{Jim Lemon}
+\seealso{\link{polygon}}
+\examples{
+ par(pty="s")
+ plot(1:5,type="n",main="Polygon Shadow test",xlab="",ylab="",axes=FALSE)
+ box()
+ # do a shadow on a yellow square
+ polygon(c(1,2.2,2.2,1),c(5,5,3.8,3.8),col="#ffff00")
+ polygon.shadow(c(1.2,2,2,1.2),c(4.8,4.8,4,4),col=c("#ffff00","#cccc00"))
+ polygon(c(1.2,2,2,1.2),c(4.8,4.8,4,4),col=c("#ff0000"))
+ # a green triangle on a light blue square with a big offset
+ polygon(c(4,5,5,4),c(2,2,1,1),col="#aaaaff")
+ polygon.shadow(c(4.5,4.8,4.2),c(1.7,1.2,1.2),col=c("#aaaaff","#8888cc"),
+  offset=c(0.1,-0.1),inflate=c(0.2,0.2))
+ polygon(c(4.5,4.8,4.2),c(1.7,1.2,1.2),col=c("#00ff00"))
+ # now a circle as a background
+ polygon.shadow(cos(seq(0,2*pi,by=pi/20))+3,sin(seq(0,2*pi,by=pi/20))+3,
+  offset=c(0,0),inflate=c(0.1,0.1))
+ text(3,3,"Polygon shadow\nas a circular\ntext background",cex=1.5)
+}
+\keyword{misc}
diff --git a/man/print.brklist.Rd b/man/print.brklist.Rd
new file mode 100755
index 0000000..3ba2ae6
--- /dev/null
+++ b/man/print.brklist.Rd
@@ -0,0 +1,29 @@
+\name{print.brklist}
+\alias{print.brklist}
+\title{Display the output of brkdnNest}
+\description{
+ Displays the list of values produced by \samp{brkdnNest}.
+}
+\usage{
+ \method{print}{brklist}(x,...)
+}
+\arguments{
+  \item{x}{a list of summary values produced by \samp{\link{brkdnNest}}}
+  \item{...}{additional arguments passed to \samp{print}.}
+}
+\details{
+ \samp{print.brklist} displays frequency tables produced by \samp{brkdnNest}.
+ It is mainly for convenience, but does make a nicer display than when passed
+ directly to \samp{print}
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{brkdnNest}}
+\examples{
+ printbrktest<-data.frame(A=c(sample(1:10,99,TRUE),NA),
+  B=sample(c("Yes","No"),100,TRUE),
+  C=sample(LETTERS[1:3],100,TRUE))
+ pbt<-brkdnNest(A~B+C,printbrktest)
+ print(pbt)
+}
+\keyword{misc}
diff --git a/man/propbrk.Rd b/man/propbrk.Rd
new file mode 100644
index 0000000..55b9825
--- /dev/null
+++ b/man/propbrk.Rd
@@ -0,0 +1,29 @@
+\name{propbrk}
+\alias{propbrk}
+\title{Calculate the proportion of specified values in a vector}
+\description{
+ Calculates the proportion of values in a vector that are equal to a specified
+ value.
+}
+\usage{
+ propbrk(x,trueval=TRUE,na.rm=TRUE)
+}
+\arguments{
+  \item{x}{a character, factor or numeric vector.}
+  \item{trueval}{the value to be matched in \samp{x}.}
+  \item{na.rm}{whether to remove NA values.}
+}
+\details{
+ \samp{propbrk} calculates the proportion of values matching a specified value.
+ It is mainly to allow proportions to be calculated in the \samp{brkdnNest}
+ function. It always discards NAs in \samp{x} when summing the number equal to
+ \samp{trueval}, but respects the \samp{na.rm} argument when calculating the
+ total number of values in \samp{x}.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{brkdnNest}}
+\examples{
+ propbrk(sample(LETTERS,100,TRUE),trueval="M")
+}
+\keyword{misc}
diff --git a/man/psegments3d.Rd b/man/psegments3d.Rd
new file mode 100755
index 0000000..a215b55
--- /dev/null
+++ b/man/psegments3d.Rd
@@ -0,0 +1,21 @@
+\name{psegments3d}
+\alias{psegments3d}
+\title{ Draw segments on a 3D plot }
+\description{
+ Draw segments on a 3D plot defined by a list of coordinates
+}
+\usage{
+ psegments3d(x,y=NULL,z=NULL,pmat,...)
+}
+\arguments{
+  \item{x,y,z}{ x, y and z coordinates to plot. \samp{x} may be a list with
+   three components.}
+ \item{pmat}{ matrix to transform coordinates. }
+  \item{...}{ Other arguments passed to \samp{segments}. }
+}
+\details{
+ Draws segments on a perspective plot.
+}
+\value{nil}
+\author{Ben Bolker}
+\keyword{misc}
diff --git a/man/ptext3d.Rd b/man/ptext3d.Rd
new file mode 100755
index 0000000..53d372e
--- /dev/null
+++ b/man/ptext3d.Rd
@@ -0,0 +1,22 @@
+\name{ptext3d}
+\alias{ptext3d}
+\title{ Display text on a 3D plot }
+\description{
+ Display text on a 3D plot defined by a list of coordinates
+}
+\usage{
+ ptext3d(x,y=NULL,z=NULL,texts,pmat,...)
+}
+\arguments{
+ \item{x,y,z}{ x, y and z coordinates to plot. \samp{x} may be a list with
+   three components.}
+ \item{pmat}{ matrix to transform coordinates. }
+ \item{texts}{ text to display. }
+ \item{...}{ Other arguments passed to \samp{segments}. }
+}
+\details{
+ Draws text on a perspective plot.
+}
+\value{nil}
+\author{Ben Bolker}
+\keyword{misc}
diff --git a/man/pyramid.plot.Rd b/man/pyramid.plot.Rd
new file mode 100755
index 0000000..f1c611f
--- /dev/null
+++ b/man/pyramid.plot.Rd
@@ -0,0 +1,124 @@
+\name{pyramid.plot}
+\alias{pyramid.plot}
+\title{Pyramid plot}
+\description{
+ Displays a pyramid (opposed horizontal bar) plot on the current
+  graphics device.
+}
+\usage{
+ pyramid.plot(lx,rx,labels=NA,top.labels=c("Male","Age","Female"),
+  main="",laxlab=NULL,raxlab=NULL,unit="\%",lxcol,rxcol,gap=1,space=0.2,
+  ppmar=c(4,2,4,2),labelcex=1,add=FALSE,xlim,show.values=FALSE,ndig=1,
+  do.first=NULL)
+}
+\arguments{
+ \item{lx,rx}{Vectors or a matrix or data frame (see Details) which
+  should be of equal length.}
+ \item{labels}{Labels for the categories represented by each pair of
+  bars. There should be a label for each lx or rx value, even if empty.
+  If \samp{labels} is a matrix or data frame, the first two columns will
+  be used for the left and right category labels respectively.} 
+ \item{top.labels}{The two categories represented on the left and right
+  sides of the plot and a heading for the labels in the center.}
+ \item{main}{Optional title for the plot.}
+ \item{laxlab}{Optional labels for the left x axis ticks.}
+ \item{raxlab}{Optional labels for the right x axis ticks.}
+ \item{unit}{The label for the units of the plot.}
+ \item{lxcol,rxcol}{Color(s) for the left and right sets of bars. Both of
+  these default to \samp{rainbow(length(labels))}.}
+ \item{gap}{One half of the space between the two sets of bars for the
+  \samp{labels} in user units.}
+ \item{space}{Space between the bars. Should be 0 <= space < 1.}
+ \item{ppmar}{Margins for the plot (see Details).}
+ \item{labelcex}{Expansion for the category labels.}
+ \item{add}{Whether to add bars to an existing plot. Usually this
+  involves overplotting a second set of bars, perhaps transparent.}
+ \item{xlim}{Optional x limit for the plot (see Details).}
+ \item{show.values}{Whether to display \samp{lx} and \samp{rx} at the
+  ends of the bars.}
+ \item{ndig}{The number of digits to round the values if displayed.}
+ \item{do.first}{Optional expression to evaluate before displaying anything.} 
+}
+\details{
+ \samp{pyramid.plot} is principally intended for population pyramids,
+ although it can display other types of opposed bar charts with suitable
+ modification of the arguments. If the user wants a different unit for
+ the display, just change \samp{unit} accordingly. The default gap of 
+ two units is usually satisfactory for the four to six percent range 
+ of most bars on population pyramids. If \samp{labels} is a matrix or
+ data frame of at least two columns, the first column will be displayed
+ on the on the left side of the gap in the center, and the second on the
+ right. This will almost always require increasing the gap width and
+ perhaps also specifying a wider plotting device. Displaying the values
+ will usually require increasing the left and/or right margins of the
+ plot, or setting \samp{xlim} larger than the largest value.
+
+ If a gap width of zero is passed, the category labels will be displayed
+ at the left and right extents of the plot. This usually requires setting
+ \samp{xlim} to values larger than the maximum extent of \samp{lx} and
+ \samp{rx}. The user can pass two different values to \samp{xlim}, but
+ this is almost always a bad idea, as the lengths of the bars will not
+ be in the same proportion to the values on the left and right sides.
+ Both the bars and category labels are vertically centered on integer
+ values, allowing the user to easily add components to the plot.
+ 
+ \samp{lx} and \samp{rx} are the values specifying the left and right
+ extents of the left and right bars respectively. If both are matrices
+ or data frames, \samp{pyramid.plot} will produce opposed stacked bars
+ with the first columns innermost. In this mode, colors are limited to
+ one per column. The stacked bar mode will in general not work with the
+ \samp{add} method or with a gap of zero. Note that the stacked bar
+ mode can get very messy very quickly.
+
+ The \samp{add} argument allows one or more sets of bars to be plotted
+ on an existing plot. If these are not transparent, any bar that is
+ shorter than the bar that overplots it will disappear. Only some graphic
+ devices (e.g. \samp{pdf}) will handle transparency.
+  
+ In order to add bars, the function cannot restore the initial margin values
+ or the new bars will not plot properly. To automatically restore the plot
+ margins, call the function as in the example.
+}
+\value{
+ The return value of \samp{par("mar")} when the function was called.
+}
+\author{Jim Lemon (thanks to Susumu Tanimura for the patch that omits
+ ticks for NA values in vector input and Igor Rebeiro for the space
+ argument)}
+\seealso{\link{rect}}
+\examples{
+ xy.pop<-c(3.2,3.5,3.6,3.6,3.5,3.5,3.9,3.7,3.9,3.5,3.2,2.8,2.2,1.8,
+  1.5,1.3,0.7,0.4)
+ xx.pop<-c(3.2,3.4,3.5,3.5,3.5,3.7,4,3.8,3.9,3.6,3.2,2.5,2,1.7,1.5,
+  1.3,1,0.8)
+ agelabels<-c("0-4","5-9","10-14","15-19","20-24","25-29","30-34",
+  "35-39","40-44","45-49","50-54","55-59","60-64","65-69","70-74",
+  "75-79","80-44","85+")
+ mcol<-color.gradient(c(0,0,0.5,1),c(0,0,0.5,1),c(1,1,0.5,1),18)
+ fcol<-color.gradient(c(1,1,0.5,1),c(0.5,0.5,0.5,1),c(0.5,0.5,0.5,1),18)
+ par(mar=pyramid.plot(xy.pop,xx.pop,labels=agelabels,
+  main="Australian population pyramid 2002",lxcol=mcol,rxcol=fcol,
+  gap=0.5,show.values=TRUE))
+ # three column matrices
+ avtemp<-c(seq(11,2,by=-1),rep(2:6,each=2),seq(11,2,by=-1))
+ malecook<-matrix(avtemp+sample(-2:2,30,TRUE),ncol=3)
+ femalecook<-matrix(avtemp+sample(-2:2,30,TRUE),ncol=3)
+ # group by age
+ agegrps<-c("0-10","11-20","21-30","31-40","41-50","51-60",
+  "61-70","71-80","81-90","91+")
+ oldmar<-pyramid.plot(malecook,femalecook,labels=agegrps,
+  unit="Bowls per month",lxcol=c("#ff0000","#eeee88","#0000ff"),
+  rxcol=c("#ff0000","#eeee88","#0000ff"),laxlab=c(0,10,20,30),
+  raxlab=c(0,10,20,30),top.labels=c("Males","Age","Females"),gap=4,
+  do.first="plot_bg(\"#eedd55\")")
+ # put a box around it
+ box()
+ # give it a title
+ mtext("Porridge temperature by age and sex of bear",3,2,cex=1.5)
+ # stick in a legend
+ legend(par("usr")[1],11,c("Too hot","Just right","Too cold"),
+  fill=c("#ff0000","#eeee88","#0000ff"))
+ # don't forget to restore the margins and background
+ par(mar=oldmar,bg="transparent")
+}
+\keyword{misc}
diff --git a/man/radial.grid.Rd b/man/radial.grid.Rd
new file mode 100644
index 0000000..1d04423
--- /dev/null
+++ b/man/radial.grid.Rd
@@ -0,0 +1,30 @@
+\name{radial.grid}
+\alias{radial.grid}
+\title{Display a radial grid}
+\usage{
+ radial.grid(labels=NA,label.pos=NULL,radlab=FALSE,radial.lim=NULL,
+  start=0,clockwise=FALSE,label.prop=1.1,grid.pos,grid.col="gray",
+  grid.bg="transparent",show.radial.grid=TRUE)
+}
+\arguments{
+ \item{labels}{The labels to display around the circumference of the grid.}
+ \item{label.pos}{Radial positions for the labels.}
+ \item{radlab}{Whether to rotate the labels to a radial orientation.}
+ \item{radial.lim}{Optional radial limits for the circular plot. If specified,
+  these must be the same as the radial limits of the original plot.}
+ \item{start}{The zero position on the plot in the units of \samp{label.pos}.}
+ \item{clockwise}{Whether to increase angles clockwise rather than the
+  default counterclockwise.}
+ \item{label.prop}{Proportion of \samp{radial.lim} to place the labels.}
+ \item{grid.pos}{Radial positions for the circular grid lines.}
+ \item{grid.col}{Color for the radial grid lines.}
+ \item{grid.bg}{Background color for the radial grid.}
+ \item{show.radial.grid}{Whether to display the radial lines on the grid.}
+}
+\description{
+ \samp{radial.grid} displays a radial grid for the \samp{radial.plot} and
+ \samp{radial.pie} functions.
+}
+\value{nil}
+\author{Jim Lemon}
+\keyword{misc}
diff --git a/man/radial.pie.Rd b/man/radial.pie.Rd
new file mode 100644
index 0000000..25cfd2d
--- /dev/null
+++ b/man/radial.pie.Rd
@@ -0,0 +1,103 @@
+\name{radial.pie}
+\alias{radial.pie}
+\title{
+ Plot sectors/annuli on a circular grid of 0 to 2*pi radians
+}
+\description{
+ Plot numeric values as sectors with optional annuli on a circular field in the
+ directions defined by angles in radians.
+}
+\usage{
+ radial.pie(radial.extents,sector.edges=NULL,
+ sector.colors=NULL,cs1=c(0,1),cs2=c(0,1),cs3=c(0,1),
+ alpha=1,labels=NA,label.pos=NULL,radlab=FALSE,start=0,
+ clockwise=FALSE,label.prop=1.1,radial.lim=NULL,main="",xlab="",ylab="",
+ mar=c(2,2,3,2),show.grid=TRUE,show.grid.labels=4,show.radial.grid=TRUE,
+ grid.col="gray",grid.bg="transparent",grid.unit=NULL,
+ radial.labels=NULL,boxed.radial=TRUE,add=FALSE,...)
+}
+\arguments{
+ \item{radial.extents}{A numeric data vector or list. If \samp{radial.extents}
+  is a list, the elements of the list will be considered separate data vectors.}
+ \item{sector.edges}{A numeric vector of positions in radians. 
+  These are interpreted as beginning at the right (0 radians) and moving
+  counterclockwise unless \samp{clockwise} is TRUE.}
+ \item{sector.colors}{Optional colors for the sectors and annuli. Defaults to
+  \samp{rainbow(nsectors)} with fading outward if annuli are specified.}
+ \item{cs1, cs2, cs3, alpha}{Color scaling arguments - see \link{color.scale}.}
+ \item{labels}{Character strings to be placed at the outer ends of
+  the lines. If set to NA, will suppress printing of labels,
+  but if missing, the radial positions will be used.}
+ \item{label.pos}{The positions of the labels around the plot in radians.}
+ \item{radlab}{Whether to rotate the outer labels to a radial orientation.}
+ \item{start}{Where to place the starting (zero) point. Defaults to the
+  3 o'clock position.}
+ \item{clockwise}{Whether to interpret positive positions as clockwise from
+  the starting point. The default is counterclockwise.}
+ \item{label.prop}{The label position radius as a proportion of the 
+  maximum line length.}
+ \item{radial.lim}{The inner and outer radial limits for the plot. Defaults
+  to the range of radial.extents, although zero to \samp{max(radial.extents)}
+  is often what is wanted.}
+ \item{main}{The title for the plot.}
+ \item{xlab,ylab}{Normally x and y axis labels are suppressed.}
+ \item{mar}{Margins for the plot. Allows the user to leave space for
+  legends, long labels, etc.}
+ \item{show.grid}{Logical - whether to draw a circular grid.}
+ \item{show.grid.labels}{Whether and where to display labels for the grid
+  - see Details.}
+ \item{show.radial.grid}{Whether to draw radial lines to the plot labels.}
+ \item{grid.col}{Color of the circular grid.}
+ \item{grid.bg}{Fill color of above.}
+ \item{grid.unit}{Optional unit description for the grid.}
+ \item{radial.labels}{Optional labels for the radial grid. The default is
+  the values of radial.lim.}
+ \item{boxed.radial}{Whether to use boxed.labels or text for radial labels.}
+ \item{add}{Whether to add one or more series to an existing plot.}
+ \item{...}{Additional arguments are passed to \samp{plot}.}
+}
+\value{
+ The \samp{par} values that are changed in the function
+ as they were at the time \samp{radial.pie} was called.
+}
+\details{
+ \samp{radial.pie} displays a plot of radial sectors with optional annular
+ sections centered at the midpoint of the plot frame, the lengths corresponding
+ to the numeric magnitudes of \samp{radial.extents}.
+
+ If more series are added to an existing plot,
+ \samp{radial.pie} will try to maintain the current plot parameters. However,
+ it seems unlikely that adding series would be sensible in \samp{radial.pie}.
+ This argument may be dropped if it proves useless.
+
+ The size of the labels on the outside of the plot can be adjusted by 
+ setting \samp{par(cex.axis=)} and that of the labels inside by setting
+ \samp{par(cex.lab=)}. If \samp{radlab} is TRUE, the labels will be rotated
+ to a radial alignment. This may help when there are many values and labels.
+ If some labels are still crowded, try running \samp{label.pos} through the
+ \samp{spreadout} function. If the \samp{show.grid.labels} argument is a number
+ from 1 to 4, the labels will be placed along a horizontal or vertical radius.
+ The numbers represent the same positions as in \samp{axis}, with the default
+ (4) on the right. To suppress these labels, pass zero or FALSE.
+
+ \samp{radial.pie} works somewhat differently from the \samp{radial.plot}
+ family and is still under development. I have released it in order to get
+ feedback to improve both the design and the programming. If successful, I
+ hope to merge the code with the \samp{radial.plot} function.
+}
+\author{Jim Lemon - thanks to Patrick Jemison for asking for it.}
+\seealso{\link{radial.plot}}
+\examples{
+ pie1<-c(3,6,5,4,7,8,9,1,4)
+ pie2<-list(0:3,1:6,2:5,1:4,0:7,4:8,2:9,0:1,0:4)
+ pie3<-sample(10:60,36)
+ pie4<-list(sort(sample(1:60,8)))
+ for(sector in 2:36) pie4[[sector]]<-sort(sample(1:60,8))
+ oldpar<-radial.pie(pie1,labels=LETTERS[1:9])
+ radial.pie(pie2,labels=letters[2:10])
+ radial.pie(pie3,labels=1:36)
+ radial.pie(pie4,labels=1:36)
+ # restore the par values
+ par(oldpar)
+}
+\keyword{misc}
diff --git a/man/radial.plot.Rd b/man/radial.plot.Rd
new file mode 100755
index 0000000..aee1d7e
--- /dev/null
+++ b/man/radial.plot.Rd
@@ -0,0 +1,166 @@
+\name{radial.plot}
+\alias{radial.plot}
+\title{
+ Plot values on a circular grid of 0 to 2*pi radians
+}
+\description{
+ Plot numeric values as distances from the center of a circular field in the
+ directions defined by angles in radians.
+}
+\usage{
+ radial.plot(lengths,radial.pos=NULL,labels=NA,label.pos=NULL,radlab=FALSE,
+ start=0,clockwise=FALSE,rp.type="r",label.prop=1.1,main="",xlab="",ylab="",
+ line.col=par("fg"),lty=par("lty"),lwd=par("lwd"),mar=c(2,2,3,2),
+ show.grid=TRUE,show.grid.labels=4,show.radial.grid=TRUE,rad.col="gray",
+ grid.col="gray",grid.bg="transparent",grid.left=FALSE,grid.unit=NULL,
+ point.symbols=1,point.col=par("fg"),show.centroid=FALSE,radial.lim=NULL,
+ radial.labels=NULL,boxed.radial=TRUE,poly.col=NA,add=FALSE,...)
+}
+\arguments{
+ \item{lengths}{A numeric data vector or matrix. If \samp{lengths}
+  is a matrix, the rows will be considered separate data vectors.}
+ \item{radial.pos}{A numeric vector or matrix of positions in radians. 
+  These are interpreted as beginning at the right (0 radians) and moving
+  counterclockwise. If \samp{radial.pos} is a matrix, the rows must 
+  correspond to rows of \samp{lengths}.}
+ \item{labels}{Character strings to be placed at the outer ends of
+  the lines. If set to NA, will suppress printing of labels,
+  but if missing, the radial positions will be used.}
+ \item{label.pos}{The positions of the labels around the plot in radians.}
+ \item{radlab}{Whether to rotate the outer labels to a radial orientation.}
+ \item{start}{Where to place the starting (zero) point. Defaults to the
+  3 o'clock position.}
+ \item{clockwise}{Whether to interpret positive positions as clockwise from
+  the starting point. The default is counterclockwise.}
+ \item{rp.type}{Whether to draw (r)adial lines, a (p)olygon, (s)ymbols
+  or some combination of these. If \samp{lengths} is a matrix and rp.type is
+  a vector, each row of \samp{lengths} can be displayed differently.}
+ \item{label.prop}{The label position radius as a proportion of the 
+  maximum line length.}
+ \item{main}{The title for the plot.}
+ \item{xlab,ylab}{Normally x and y axis labels are suppressed.}
+ \item{line.col}{The color of the radial lines or polygons drawn.}
+ \item{lty}{The line type(s) to be used for polygons or radial lines.}
+ \item{lwd}{The line width(s) to be used for polygons or radial lines.}
+ \item{mar}{Margins for the plot. Allows the user to leave space for
+  legends, long labels, etc.}
+ \item{show.grid}{Logical - whether to draw a circular grid.}
+ \item{show.grid.labels}{Whether and where to display labels for the grid
+  - see Details.}
+ \item{show.radial.grid}{Whether to draw radial lines to the plot labels.}
+ \item{rad.col}{Color of the radial lines on the grid.}
+ \item{grid.col}{Color of the circumferential lines on the grid.}
+ \item{grid.bg}{Fill color of above.}
+ \item{grid.left}{Whether to place the radial grid labels on the left side.}
+ \item{grid.unit}{Optional unit description for the grid.}
+ \item{point.symbols}{The symbols for plotting (as in pch).}
+ \item{point.col}{Colors for the symbols.}
+ \item{show.centroid}{Whether to display a centroid.}
+ \item{radial.lim}{The range of the grid circle. Defaults to
+  \samp{pretty(range(lengths))}, but if more than two values are passed, the
+  exact values will be displayed.}
+ \item{radial.labels}{Optional labels for the radial grid. The default is
+  the values of radial.lim.}
+ \item{boxed.radial}{Whether to use boxed.labels or text for radial labels.}
+ \item{poly.col}{Fill color if polygons are drawn. Use NA for no fill.}
+ \item{add}{Whether to add one or more series to an existing plot.}
+ \item{...}{Additional arguments are passed to \samp{plot}.}
+}
+\value{
+ The \samp{par} values that are changed in the function
+ as they were at the time \samp{radial.plot} was called.
+}
+\details{
+ \samp{radial.plot} displays a plot of radial lines, polygon(s),
+ symbols or a combination of these centered at the midpoint of
+ the plot frame, the lengths, vertices or positions corresponding
+ to the numeric magnitudes of the data values. If \samp{show.centroid}
+ is TRUE, an enlarged point at the centroid of values is displayed. The
+ centroid is calculated as the average of x and y values unless 
+ \samp{rp.type="p"}. In this case, the barycenter of the polygon is
+ calculated. Make sure that these suit your purpose, otherwise calculate
+ the centroid that you really want and add it with the \samp{points} function.
+ Note that if the observations are not taken at equal intervals around the
+ circle, the centroid may not mean much.
+  
+ If the user wants to plot several sets of lines, points or symbols by
+ passing matrices or data frames of \samp{lengths} and \samp{radial.pos},
+ remember that these will be grouped by row, so transpose if the data are
+ grouped by columns.
+
+ If more series are added to an existing plot,
+ \samp{radial.plot} will try to maintain the current plot parameters.
+ Resetting the parameters after doing the initial plot will almost certainly
+ mess up any series that are added. Series that are added will be plotted
+ "on top" of the existing plot, possibly overplotting other things. If the
+ added series have a larger range than the initial series, set \samp{radial.lim}
+ to account for this in the initial plot, and if \samp{radial.lim} is specified
+ in the initial plot, remember to repeat it for added series as in the example.
+
+ The size of the labels on the outside of the plot can be adjusted by 
+ setting \samp{par(cex.axis=)} and that of the labels inside by setting
+ \samp{par(cex.lab=)}. If \samp{radlab} is TRUE, the labels will be rotated
+ to a radial alignment. This may help when there are many values and labels.
+ If some labels are still crowded, try running \samp{label.pos} through the
+ \samp{spreadout} function. If the \samp{show.grid.labels} argument is a number
+ from 1 to 4, the labels will be placed along a horizontal or vertical radius.
+ The numbers represent the same positions as in \samp{axis}, with the default
+ (4) on the right.
+
+ The radial.plot family of plots is useful for illustrating
+ cyclic data such as wind direction or speed (but see \samp{oz.windrose}
+ for both), activity at different times of the day, and so on. While 
+ \samp{radial.plot} actually does the plotting, another function is usually 
+ called for specific types of cyclic data.
+}
+\author{Jim Lemon - thanks to Jeremy Claisse and Antonio Hernandez Matias
+ for the \samp{lty} and \samp{rp.type} suggestions respectively, Patrick
+ Baker for the request that led to \samp{radlab}, Thomas Steiner for
+ the request for the \samp{radial.lim} and \samp{radial.labels} modifications,
+ Evan Daugharty for requesting the \samp{add} argument, James MacCarthy
+ for requesting better radial labels, Steve Ellison for noticing that
+ the return values of the functions had changed, Don Dennerline for
+ requesting the rank clock, Mehdi Nellen for the different colors for
+ the radial and circumferential lines for the grid and Mayeul Kauffmann for
+ noticing the radial label bug when a separate radial.grid was included.}
+\seealso{\link{polar.plot},\link{clock24.plot}}
+\examples{
+ testlen<-runif(10,0,10)
+ testpos<-seq(0,18*pi/10,length=10)
+ testlab<-letters[1:10]
+ oldpar<-radial.plot(testlen,testpos,main="Test Radial Lines",line.col="red",
+  lwd=3,rad.col="lightblue")
+ testlen<-c(sin(seq(0,1.98*pi,length=100))+2+rnorm(100)/10)
+ testpos<-seq(0,1.98*pi,length=100)
+ radial.plot(testlen,testpos,rp.type="p",main="Test Polygon",line.col="blue",
+  labels=LETTERS[1:8])
+ # now do a 12 o'clock start with clockwise positive
+ radial.plot(testlen,testpos,start=pi/2,clockwise=TRUE,show.grid.labels=2,
+  rp.type="s",main="Test Symbols (clockwise)",radial.lim=c(0,3.5),
+  point.symbols=16,point.col="green",show.centroid=TRUE,labels=LETTERS[1:6])
+ # one without the circular grid and multiple polygons
+ # see the "diamondplot" function for variation on this
+ posmat<-matrix(sample(2:9,30,TRUE),nrow=3)
+ radial.plot(posmat,labels=paste("X",1:10,sep=""),rp.type="p",
+  main="Spiderweb plot",line.col=2:4,show.grid=FALSE,lwd=1:3,
+  radial.lim=c(0,10))
+ # dissolved ions in water
+ ions<-c(3.2,5,1,3.1,2.1,4.5)
+ ion.names<-c("Na","Ca","Mg","Cl","HCO3","SO4")
+ radial.plot(ions,labels=ion.names,rp.type="p",main="Dissolved ions in water",
+  grid.unit="meq/l",radial.lim=c(0,5),poly.col="yellow",show.grid.labels=1)
+ # add points inside the polygon - radial.lim is supplied by plotrix_env
+ radial.plot(ions-0.4,rp.type="s",point.symbols=4,point.col="red",add=TRUE)
+ radmat<-matrix(c(sample(1:4,4),sample(1:4,4),sample(1:4,4),sample(1:4,4),
+  sample(1:4,4),sample(1:4,4),sample(1:4,4),sample(1:4,4),
+  sample(1:4,4),sample(1:4,4)),nrow=4)
+ # finally a rank clock
+ radial.plot(radmat,rp.type="l",radial.pos=seq(0,20*pi/11.1,length.out=10),
+  label.pos=seq(0,20*pi/11.1,length.out=10),start=pi/2,clockwise=TRUE,
+  labels=2001:2010,radial.lim=c(0.2,4),main="Rank clock")
+ legend(-1.7,4,c("Black","Red","Green","Blue"),col=1:4,lty=1)
+ par(xpd=oldpar$xpd,mar=oldpar$mar,pty=oldpar$pty)
+ # reset the margins
+ par(mar=c(5,4,4,2))
+}
+\keyword{misc}
diff --git a/man/radial.plot.labels.Rd b/man/radial.plot.labels.Rd
new file mode 100755
index 0000000..857efea
--- /dev/null
+++ b/man/radial.plot.labels.Rd
@@ -0,0 +1,53 @@
+\name{radial.plot.labels}
+\title{Display labels on a circular grid}
+\usage{
+ radial.plot.labels(lengths,radial.pos=NULL,units="radians",radial.lim=NULL,
+  start=0,clockwise=FALSE,labels,adj=NULL,pos=NULL,...)
+}
+\alias{radial.plot.labels}
+\arguments{
+ \item{lengths}{numeric data vector. Magnitudes will be represented as
+  the radial positions of symbols, line ends or polygon vertices.}
+ \item{radial.pos}{numeric vector of radial positions. These will be 
+  converted to radians if the \samp{units} argument is not "radians".}
+ \item{units}{The units of \samp{radial.pos} may be degrees or 24 hour clock
+  positions. If \samp{units} is "polar" or "clock24" respectively, the
+  values of radial.pos will be converted into radians.}
+ \item{radial.lim}{Optional radial limits for the circular plot. These
+  must be the same as the radial limits of the original plot.}
+ \item{start}{The zero position on the plot in the units of \samp{radial.pos}.}
+ \item{clockwise}{Whether to increase angles clockwise rather than the
+  default counterclockwise.}
+ \item{labels}{text labels to display on the plot.}
+ \item{adj}{Text justification as in the \samp{text} function.}
+ \item{pos}{Text position as in the \samp{text} function.}
+ \item{...}{additional arguments passed to \samp{text}.}
+}
+\description{
+ \samp{radial.plot.labels} displays a labels on a circular plot produced by
+  one of the radial.plot family of functions.
+}
+\details{
+ Don't confuse this function with the \samp{radial.labels} argument in
+ the radial.plot function. This labels the values rather than the grid.
+}
+\value{nil}
+\author{Jim Lemon}
+\keyword{misc}
+\seealso{\link{text}}
+\examples{
+ testlen<-c(rnorm(10)*2+5)
+ # do the labels in clock24 units
+ testpos<-c(6.74,8.3,10.55,12.33,13.75,15.9,17.15,19.36,21.02,23.27)
+ oldpar<-clock24.plot(testlen,testpos,main="Test radial.plot.labels",
+  rp.type="s",point.symbols=3,point.col="blue")
+ radial.plot.labels(testlen,testpos,units="clock24",labels=LETTERS[1:10],
+  pos=3,col="blue")
+ testangle<-c(25,42,67,94,128,173,191,234,268,307)
+ # now a polar plot
+ polar.plot(testlen,testangle,main="Test radial.plot.labels",rp.type="p",
+  poly.col="green")
+ radial.plot.labels(testlen,testangle,units="polar",labels=LETTERS[1:10])
+ # reset par
+ par(oldpar)
+}
diff --git a/man/radialtext.Rd b/man/radialtext.Rd
new file mode 100644
index 0000000..a21287c
--- /dev/null
+++ b/man/radialtext.Rd
@@ -0,0 +1,73 @@
+\name{radialtext}
+\alias{radialtext}
+\title{Display text in a radial line}
+\description{
+ Displays a string in a radial line, rotating it to flow in the radial
+ direction and optionally scaling each letter's size according to its
+ distance from the center.
+}
+\usage{
+ radialtext(x, center=c(0,0), start=NA, middle=1, end=NA, angle=0,
+  deg=NA, expand=0, stretch=1, nice=TRUE, cex=NA, ...)
+}
+\arguments{
+ \item{x}{A character string.}
+ \item{center}{The center of the circular area in x/y user units.}
+ \item{start}{The starting distance of the string from the center in
+  x/y user units.}
+ \item{middle}{The middle distance of the string from the center in
+  x/y user units.}
+ \item{end}{The ending distance of the string from the center in
+  x/y user units.}
+ \item{angle}{The angular position of the string in radians.}
+ \item{deg}{The angular position of the string in degrees
+  (takes precedence if not NA).}
+ \item{expand}{Size expansion factor for characters, used only if
+  \samp{start} specified.}
+ \item{stretch}{How much to stretch the string for appearance, 1 for none.}
+ \item{nice}{TRUE to auto-flip text to keep it upright, FALSE to let
+  it be upside down.}
+ \item{cex}{The overall character expansion factor, NA for par("cex").}
+ \item{...}{Additional arguments passed to \samp{text}.}
+}
+\value{nil}
+\details{
+ This may not work on all devices, as not all graphic devices can rotate text to
+ arbitrary angles. The output looks best on a Postscript or similar device that can
+ rotate text without distortion. Rotated text often looks very ragged on small bitmaps.
+ If the user passes a value for \samp{start}, this will override a value for
+ \samp{middle} or \samp{end}. Likewise, a value for \samp{end} will override a
+ value for \samp{middle}. Also, a value for \samp{deg} overrides any value passed
+ to \samp{angle}. If \samp{expand} is 0, all characters will be the same size,
+ while a value of 1 will scale characters so that one that is twice
+ as far from the center will be twice as large. Negative values are permitted too,
+ but \samp{expand} is only used if \samp{start} was specified.
+}
+\author{Ted Toal}
+\seealso{\link{text}, \link{arctext}}
+\examples{
+ plot(0, xlim=c(1,5), ylim=c(1,5), main="Test of radialtext",
+  xlab="", ylab="", type="n")
+ points(3, 3, pch=20)
+ radialtext("uncooked spaghetti", center=c(3,3),
+  col="blue")
+ radialtext("uncooked spaghetti", center=c(3,3),
+  start=1.2, angle=pi/4, cex=0.8)
+ radialtext("uncooked spaghetti", center=c(3,3),
+  middle=1.2, angle=pi/4+0.1, cex=0.8)
+ radialtext("uncooked spaghetti", center=c(3,3),
+  end=1.2, angle=pi/4+0.2, cex=0.8)
+ radialtext("uncooked spaghetti", center=c(3,3),
+  start=0.5, deg=135, cex=0.8, col="green")
+ radialtext("uncooked spaghetti", center=c(3,3),
+  start=0.5, deg=145, cex=0.8, stretch=2)
+ radialtext("uncooked spaghetti", center=c(3,3),
+  start=0.5, deg=20, expand=0, col="red")
+ radialtext("uncooked spaghetti", center=c(3,3),
+  start=0.5, deg=250, expand=0.35)
+ radialtext("uncooked spaghetti", center=c(3,3),
+  start=0.75, deg=225, expand=1, col="gold")
+ radialtext("uncooked spaghetti", center=c(3,3),
+  start=0.5, deg=325, expand=-0.25, cex=2)
+}
+\keyword{misc}
diff --git a/man/raw.means.plot.Rd b/man/raw.means.plot.Rd
new file mode 100644
index 0000000..d099c64
--- /dev/null
+++ b/man/raw.means.plot.Rd
@@ -0,0 +1,362 @@
+\name{raw.means.plot}
+\alias{raw.means.plot}
+\alias{raw.means.plot2}
+\title{
+raw.means.plot: Raw-Means Plots for Experimental Designs
+}
+\description{
+raw.means.plot is a function for visualizing results of experimental designs
+ with up to two factors. It plots both raw data (background) and factor/cell
+ means (foreground) to provide a more accurate visualization of the underlying
+ distribution.
+}
+\usage{
+raw.means.plot(data, col.offset = 2, col.x = 3, col.value = 4, na.rm = FALSE,
+ avoid.overlap = c("y", "x", "both"), y.factor = 1, y.amount = NULL,
+ x.amount = 0.05, pch = 21:25, lty = 1:5, bg.b.col = "darkgrey",
+ bg.f.col = NULL, fg.b.col = "black",fg.f.col = "black", type = "o",
+ pt.cex = 1, lwd = 1, xlab = "", ylab = "", ylim, max.offset = 0.2,
+ xaxis = TRUE, x.labels, xaxt = "n", plot = TRUE, legend = TRUE, mar = NULL,
+ reset.mar = TRUE, l.pos, yjust = 0.5, l.bty = "n", l.adj = c(0, 0.5), ...)
+
+raw.means.plot2(data, col.id, col.offset, col.x, col.value,
+ fun.aggregate = "mean", ...)
+
+}
+\arguments{
+  \item{data}{
+ a \samp{data.frame} in long format (i.e., each datapoint one row,
+ see \samp{\link{reshape}} or the reshape package) that contains at least
+ three columns: one column coding the first factor (\samp{col.offset}), one
+ column coding the second factor (\samp{col.x}), and one column containing
+ the values (\samp{col.value}).
+}
+  \item{col.id}{
+ a \samp{character} scalar, specifiying the name of the column specifying the
+ id column. (only for \samp{raw.means.plot2})
+}
+  \item{col.offset}{
+ a \samp{character} or \samp{numeric} (only \samp{raw.means.plot}) scalar,
+ specifiying either name or number of the column coding the different lines
+ (the offset or first factor).
+}
+  \item{col.x}{
+ a \samp{character} or \samp{numeric} (only \samp{raw.means.plot}) scalar,
+ specifiying either name or number of the column coding the x-axis factor.
+ Default is 3.
+}
+  \item{col.value}{
+ a \samp{character} or \samp{numeric} (only \samp{raw.means.plot}) scalar,
+ specifiying either name or number of the data column. Default is 4.
+}
+  \item{na.rm}{
+\samp{logical} indicating whether \samp{NA} values should be stripped before
+ the computation proceeds. Default is \samp{FALSE}. Throws an error message
+ if FALSE and NAs are encountered.
+}
+  \item{avoid.overlap}{
+ character. What should happen to datapoints within one cell of the two
+ factors that have the same value.
+\itemize{
+ \item \samp{"y"} (the default) \link{jitter} is added so that
+  overlapping points are distinguishable on the \strong{y}-axis
+ \item \samp{"x"} \link{jitter} is added so that overlapping points
+ are distinguishable on the \strong{x}-axis
+ \item \samp{"both"} \link{jitter} is added so that overlapping points
+ are distinguishable on both the \strong{y}- and the \strong{x}-axis.
+ \item anything else. No jitter is added.
+}
+}
+  \item{y.factor}{
+ \samp{factor} for controlling the amount of jitter on the y-axis
+ (will be passed to \link{jitter}).
+}
+  \item{y.amount}{
+ \samp{amount} for controlling the amount of jitter on the y-axis
+ (will be passed to \link{jitter}).
+}
+  \item{x.amount}{
+ \samp{amount} for controlling the amount of jitter on the x-axis
+ (will be passed to \link{jitter}).
+}
+  \item{pch}{
+ \samp{pch} values (plot symbols) taken for plotting the data. Note that
+ the same values are taken for raw data and means. see \link{points}
+ for more details. Recycled if too short (with warning). Default is 21:25,
+ because those are the only values that can be displayed filled and non-filled.
+ All other values should not be used. 
+}
+  \item{lty}{
+\samp{lty} values (line types) for connecting the means. See \link{par}
+ for more details. Recycled if too short (with warning). Default is 1:5.
+}
+  \item{bg.b.col}{
+ background border color: border color of raw data points. Silently recycled. Default:
+ \samp{"darkgrey"} 
+}
+  \item{bg.f.col}{
+ background filling color: fill color of raw data points. Silently recycled. Default:
+ \samp{NULL}
+}
+  \item{fg.b.col}{
+ foreground border color: border color of mean data points. Silently recycled. Default:
+ \samp{black}
+}
+  \item{fg.f.col}{
+ foreground fill color: fill color for mean data points. Silently recycled. Default:
+ \samp{black}
+}
+  \item{type}{
+ same as type in \link{plot}. Default: \samp{o} ("overplotted")
+}
+  \item{pt.cex}{
+ \samp{numeric} specifying the \samp{cex} value used for plotting the points.
+ Default is 1.
+}
+  \item{lwd}{
+ \samp{numeric} specifying the \samp{lwd} value used for plotting the lines.
+ Default is 1.
+}
+  \item{xlab}{
+ x-axis label. Default: \samp{""}
+}
+  \item{ylab}{
+ y-axis label. Default: \samp{""}
+}
+  \item{ylim}{
+ the y-axis limits of the plot. If not specified (the default) will be taken
+ from data so that all raw data points are visible and a warning message is
+ displayed specifying the ylim.
+}
+  \item{max.offset}{
+ \samp{numeric}. maximal offset of factor levels from the offset factor
+ (\samp{col.offset}) specifying the different lines. The centre of each factor
+ on the x-axis is at full numbers (starting from 1 to ...). The maximum will
+ only be reached if the number of factor levels (from \samp{col.offset}) is
+ even. Default: 0.2.
+}
+  \item{xaxis}{
+ \samp{logical} value indicating whether or not the x-axis should be generated
+ by \samp{raw.means.plot}. If \samp{TRUE}, labels for the x-axis will be taken
+ either from the unique values of \samp{col.x} or can be specified with
+ \samp{x.labels}.
+}
+  \item{x.labels}{
+ \samp{character} vector specifiying \samp{col.x} levels. Only relevant if
+ \samp{xaxis=TRUE}. Then, the values given here will be displayed at the
+ x-axis for each factor level of \samp{col.x}.
+}
+  \item{xaxt}{
+ A character which specifies whether ot not the x-axis should be plotted by
+ the call to plot function. Interfers with the aforementioned \samp{xaxis}
+ argument and the automatic \samp{xaxis} function by \samp{raw.means.plot}.
+ Just there for completeness. Default \samp{"n"} (and should not be changed).
+}
+  \item{plot}{
+ \samp{logical}. Should the \samp{raw.means.plot} be drawn or not. If
+ \samp{TRUE} (the default) plot will be drawn. If \samp{FALSE} only the legend
+ will be drawn (if \samp{legend = TRUE}) See details.
+}
+  \item{legend}{
+ \samp{logical} indicating whether or not \samp{raw.means.plot} should
+ automatically add a legend on the right outside the plot area indicating
+ which line and points refer to which \samp{col.offset} factor levels. Default
+ is \samp{TRUE}.
+}
+  \item{mar}{
+ \samp{NULL} or \samp{numerical} vector of length 4 indicating the margins of
+ the plot (see \link{par}). If \samp{NULL} (the default) the right
+ margin (i.e., \samp{par("mar")[4]}) will be (imperfectly) guessed from the
+ \samp{col.offset} factors for placing the legend right to the plot. If length
+ is four this value will be taken. Ignored for \samp{plot = FALSE}.
+}
+  \item{reset.mar}{
+\samp{logical} indicating if the margins (\samp{mar}) shall be resetted after
+ setting internally. Will be ignored if \samp{legend = FALSE}. Default is
+ \samp{TRUE} and should not be changed (especially with \samp{plot = FLASE}).
+}
+  \item{l.pos}{
+ \samp{numeric} vector of length 2 indicating the position of the legend. If
+ not specified automatically determined. See details.
+}
+  \item{yjust}{
+ how the legend is to be justified relative to the legend y location. A value
+ of 0 means top, 0.5 means centered and 1 means bottom justified. Default is
+ 0.5.
+}
+  \item{l.bty}{
+ the type of box to be drawn around the legend. The allowed values are
+ \samp{"o"} and \samp{"n"} (the default).
+}
+  \item{l.adj}{
+ \samp{numeric} of length 1 or 2; the string adjustment for legend text. Useful
+ for y-adjustment when labels are plotmath expression. see \link{legend}
+ and \link{plotmath} for more info.
+}
+  \item{\dots}{
+ further arguments which are either passed to plot or legend (or
+ \samp{raw.means.plot} for \samp{raw.means.plot2}). The following arguments
+ are passed to legend, all others are passed to plot:
+ \samp{"fill", "border", "angle", "density", "box.lwd", "box.lty", "box.col",
+ "pt.cex", "pt.lwd", "xjust", "x.intersp", "y.intersp", "text.width",
+ "text.col", "merge", "trace", "plot", "ncol", "horiz", "title", "inset",
+ "title.col", "title.adj"}
+}
+  \item{fun.aggregate}{
+ Function or function name used for aggregating the data across the two
+ factors. Default is \samp{"mean"}. (only for \samp{raw.means.plot2})
+}
+}
+\details{
+
+\samp{raw.means.plot2} is probably the more useful function, as it allows for
+ using a data.frame with more than two-factors and aggregates across the other
+ factors, but needs a column specifying the experimental unit (e.g.,
+ participant).
+
+\samp{raw.means.plot} is basically an advanced wrapper for two other
+ functions: \link{plot} and (if \samp{legend=TRUE})
+ \link{legend}. Furthermore, raw data is plotted with a call to
+ \link{points} and the means with a call to \link{lines}.
+
+You can use \samp{raw.means.plot} to plot only a legend by setting
+ \samp{plot = FALSE} and \samp{legend = TRUE}. Then, \samp{raw.means.plot}
+ will draw an invisible plot with \samp{xlim = c(0,10)} and
+ \samp{ylim = c(0, 10)} and place the legend on this invisible plot. You
+ can specify \samp{l.pos} to position the legend, otherwise it will be plotted
+ at \samp{c(5,5)} (i.e., in the middle of the plot). Note that
+ \samp{xpd = TRUE} in the call to \samp{legend} (see \link{par}).
+}
+\value{
+Nothing. This function is invoked for its side effects.
+}
+\author{
+Henrik Singmann (\email{henrik.singmann at psychologie.uni-freiburg.de}) with
+ ideas from Jim Lemon
+}
+\seealso{
+\link{add.ps} can be used in addition to\samp{raw.means.plot} to
+ compare the factors at each x-axis position, by adding p-values from t-tests
+ to the x-axis.
+}
+
+
+\examples{
+
+x <- data.frame(id = 1:150, offset = rep(c("Group A", "Group B", "Group C"),
+ each = 50), xaxis = sample(c("A", "B", "C", "D"),150, replace = TRUE),
+ data = c(rnorm(50, 10, 5), rnorm(50, 15,6), rnorm(50, 20, 5)))
+
+raw.means.plot(x)
+
+raw.means.plot(x, main = "Example", ylab = "Values", xlab = "Factor",
+ title = "Groups")
+
+raw.means.plot(x, "offset", "xaxis", "data")
+
+raw.means.plot(x, "xaxis", "offset", "data")
+
+raw.means.plot(x, 3, 2, 4)
+
+# different colors:
+raw.means.plot(x, main = "Example", ylab = "Values", xlab = "Factor",
+ title = "Groups", fg.f.col = c("red","blue", "green"))
+
+x2 <- data.frame(id = 1:150, offset = rep(c("Group A", "Group B", "Group C"),
+ each = 50), xaxis = sample(c("A", "B", "C", "D"),150, replace = TRUE),
+ data = c(rnorm(50, 10, 5), rnorm(50, 15,6), rnorm(50, 20, 5)))
+
+layout(matrix(c(1,2,3,3), 2,2,byrow = TRUE), heights = c(7,1))
+raw.means.plot(x, main = "Data x1", ylab = "Values", xlab = "Factor",
+ legend = FALSE, mar = c(4,4,4,1)+0.1)
+raw.means.plot(x2, main = "Data x2", ylab = "Values", xlab = "Factor",
+ legend = FALSE, mar = c(4,4,4,1)+0.1)
+raw.means.plot(x2, plot = FALSE, title = "Groups")
+
+
+y <- data.frame(id = 1:300, offset = rep(1, 300),
+ axis = sample(LETTERS[1:6],300, replace = TRUE), data = c(rnorm(100, 1),
+ rnorm(100), rnorm(100,1)))
+
+par(mfrow = c(2,2))
+
+raw.means.plot(y, legend = FALSE)
+
+raw.means.plot(y, type = "p", legend = FALSE)
+
+raw.means.plot(y, type = "l", legend = FALSE)
+
+raw.means.plot(y, 3, 2, x.labels = "one group only")
+
+
+# Example with overlapping points
+z <- data.frame (id = 1:200, offset = rep(c("C 1", "C 2"), 200),
+ axis = sample(LETTERS[1:4], 200, replace = TRUE),
+ data = sample(1:20, 200, replace = TRUE))
+
+# x versus y jitter
+par(mfrow = c(2,2))
+raw.means.plot(z, avoid.overlap = "none", main = "no-jitter")
+raw.means.plot(z, main = "y-axis jitter (default)")
+raw.means.plot(z, avoid.overlap = "x", main = "x-axis jitter")
+raw.means.plot(z, avoid.overlap = "both", main = "both-axis jitter")
+
+
+# y-axis jitter (default)
+par(mfrow = c(2,2))
+raw.means.plot(z, avoid.overlap = "none", main = "no jitter")
+raw.means.plot(z, y.factor = 0.5, main = "smaller y-jitter")
+raw.means.plot(z, main = "standard y-jitter")
+raw.means.plot(z, y.factor = 2, main = "bigger y-jitter")
+
+
+# x-axis jitter (default)
+par(mfrow = c(2,2))
+raw.means.plot(z, avoid.overlap = "none", main = "no jitter")
+raw.means.plot(z, avoid.overlap = "x", x.amount = 0.025,
+ main = "smaller x -jitter")
+raw.means.plot(z, avoid.overlap = "x", main = "standard x-jitter")
+raw.means.plot(z, avoid.overlap = "x", x.amount= 0.1,
+ main = "bigger x-jitter")
+
+
+
+\dontrun{
+
+#The examples uses the OBrienKaiser dataset from car and needs reshape.
+require(reshape)
+require(car)
+data(OBrienKaiser)
+OBKnew <- cbind(factor(1:nrow(OBrienKaiser)), OBrienKaiser)
+colnames(OBKnew)[1] <- "id"
+OBK.long <- melt(OBKnew)
+OBK.long[, c("measurement", "time")] <-
+ t(vapply(strsplit(as.character(OBK.long$variable), "\\\."),  "[", c("", "")))
+
+raw.means.plot2(OBK.long, "id", "measurement", "gender", "value")
+
+raw.means.plot2(OBK.long, "id", "treatment", "gender", "value")
+
+# also use add.ps:
+# For this example the position at each x-axis are within-subject comparisons!
+raw.means.plot2(OBK.long, "id", "measurement", "gender", "value")
+add.ps(OBK.long, "id", "measurement", "gender", "value", paired = TRUE)
+ #reference is "fup"
+
+raw.means.plot2(OBK.long, "id", "measurement", "gender", "value")
+add.ps(OBK.long, "id", "measurement", "gender", "value", ref.offset = 2,
+ paired = TRUE) #reference is "post"
+
+# Use R's standard (i.e., Welch test)
+raw.means.plot2(OBK.long, "id", "treatment", "gender", "value")
+add.ps(OBK.long, "id", "treatment", "gender", "value",
+ prefixes = c("p(control vs. A)", "p(control vs. B)"))
+
+# Use standard t-test
+raw.means.plot2(OBK.long, "id", "treatment", "gender", "value")
+add.ps(OBK.long, "id", "treatment", "gender", "value", var.equal = TRUE,
+ prefixes = c("p(control vs. A)", "p(control vs. B)"))
+
+}
+
+}
diff --git a/man/rectFill.Rd b/man/rectFill.Rd
new file mode 100755
index 0000000..1fac42c
--- /dev/null
+++ b/man/rectFill.Rd
@@ -0,0 +1,36 @@
+\name{rectFill}
+\alias{rectFill}
+\title{Draw a rectangle filled with symbols}
+\description{
+ Draws a rectangle on the current figure filled with arbitrary symbols.
+}
+\usage{
+ rectFill(x1,y1,x2,y2,fg=par("fg"),bg=par("bg"),xinc=NA,yinc=NA,
+  pch=1,pch.cex=1,pch.col=par("fg"),...)
+}
+\arguments{
+ \item{x1,y1,x2,y2}{Rectangle limits as in \samp{rect}.}
+ \item{fg}{Foreground color}
+ \item{bg}{Background color}
+ \item{xinc,yinc}{The x and y increments of spacing for the symbols.}
+ \item{pch}{Which symbol to use}
+ \item{pch.cex}{Character expansion for the symbols.}
+ \item{pch.col}{Color(s) for the symbols. }
+ \item{...}{Additional arguments to \samp{points} for the symbols.}
+}
+\details{
+ \samp{rectFill} draws a rectangle and fills the rectangle with the
+ symbols requested. It is probably most useful as a substitute for
+ fill colors in a black and white environment.
+}
+\value{ nil }
+\author{Jim Lemon}
+\seealso{\link{rect}, \link{points}}
+\examples{
+ plot(1:7,type="n",xlab="",ylab="",main="Test of rectFill")
+ rectFill(1:6,1:6,2:7,2:7,bg=2:7,pch=c("+","*","o",".","#","^"),
+  xinc=c(0.2,0.1,0.2,0.1,0.2,0.2),yinc=c(0.2,0.1,0.2,0.1,0.2,0.2),
+  pch.col=1:6)
+ barp(matrix(runif(9),nrow=3),main="Black and white bar plot",pch=1:3)
+}
+\keyword{misc}
diff --git a/man/rescale.Rd b/man/rescale.Rd
new file mode 100755
index 0000000..9f6aad7
--- /dev/null
+++ b/man/rescale.Rd
@@ -0,0 +1,31 @@
+\name{rescale}
+\title{Scale numbers into a new range}
+\description{Scale a vector or matrix of numbers into a new range.}
+\usage{
+ rescale(x,newrange)
+}
+\alias{rescale}
+\arguments{
+ \item{x}{A numeric vector, matrix or data frame.}
+ \item{newrange}{The minimum and maximum value of the range into which
+  \samp{x} will be scaled.}
+}
+\details{
+ \samp{rescale} performs a simple linear conversion of \samp{x} into the
+  range specified by \samp{newrange}. Only numeric vectors, matrices or data
+  frames with some variation will be accepted. NAs are now preserved - 
+  formerly the function would fail.
+}
+\value{On success, the rescaled object, otherwise the original object.}
+\author{Jim Lemon}
+\examples{
+ # scale one vector into the range of another
+ normal.counts<-rnorm(100)
+ normal.tab<-tabulate(cut(normal.counts,breaks=seq(-3,3,by=1)))
+ normal.density<-rescale(dnorm(seq(-3,3,length=100)),range(normal.tab))
+ # now plot them
+ plot(c(-2.5,-1.5,-0.5,0.5,1.5,2.5),normal.tab,xlab="X values",
+  type="h",col="green")
+ lines(seq(-3,3,length=100),normal.density,col="blue")
+}
+\keyword{misc}
diff --git a/man/revaxis.Rd b/man/revaxis.Rd
new file mode 100755
index 0000000..2de4b85
--- /dev/null
+++ b/man/revaxis.Rd
@@ -0,0 +1,40 @@
+\name{revaxis}
+\alias{revaxis}
+\title{ Plot with axis direction(s) reversed }
+\description{
+   Reverses the sense of either or both the \samp{x} and \samp{y} axes.
+}
+\usage{
+revaxis(x, y, xrev=FALSE, yrev=TRUE, xside=if (yrev) 3 else 1,
+       yside=if (xrev) 4 else 2, xlab=NULL, ylab=NULL, bty=NULL, ...)
+
+}
+\arguments{
+   \item{x}{ Vector of \samp{x}-coordinates of the data to be plotted. }
+   \item{y}{ Vector of \samp{y}-coordinates of the data to be plotted. }
+   \item{xrev}{ Logical scalar; should the sense of the \samp{x}-axis
+    be reversed?}
+   \item{yrev}{ Logical scalar; should the sense of the \samp{y}-axis
+    be reversed?}
+   \item{xside}{ The side of the plot on which the \samp{x}-axis labels
+   should go.}
+   \item{yside}{ The side of the plot on which the \samp{y}-axis labels
+   should go.}
+   \item{xlab}{ Character string for labelling the \samp{x}-axis. }
+   \item{ylab}{ Character string for labelling the \samp{y}-axis. }
+   \item{bty}{ Single letter indicating the type of box to be drawn
+   around the plot. See \link{par} for the possible letters
+   and their meaning.}
+   \item{\dots}{ Other arguments to be passed to plot.}
+}
+
+\value{ nil }
+\author{Rolf Turner}
+\seealso{ \link{plot}, \link{box}, \link{par}}
+
+\examples{
+x <- runif(20)
+y <- runif(20)
+revaxis(x,y,yside=4)
+}
+\keyword{ hplot }
diff --git a/man/ruginv.Rd b/man/ruginv.Rd
new file mode 100644
index 0000000..f27e0bb
--- /dev/null
+++ b/man/ruginv.Rd
@@ -0,0 +1,32 @@
+\name{ruginv}
+\alias{ruginv}
+\title{Add an Inverse Rug to a Plot}
+\description{Adds a \emph{rug} representation (1D plot) of the data to the plot,
+ but with the coloring inverted.}
+\usage{
+ ruginv(x,ticksize=0.03,side=1,lwd=0.5,col=par("fg"),col.ticks="white",
+ quiet=getOption("warn") < 0,...)
+}
+\arguments{
+ \item{x}{A numeric vector.}
+ \item{ticksize}{The length of the ticks making up the 'rug'. Positive lengths
+  produce inward ticks.}
+ \item{side}{On which side of the plot box the rug will appear. Usually 1
+  (bottom) or 3 (top).}
+ \item{lwd}{The line width of the ticks.}
+ \item{col}{Color of the background of the ticks.}
+ \item{col.ticks}{The color of the ticks.}
+ \item{quiet}{Logical indicating if there should be a warning about clipped
+  values.}
+ \item{...}{Further arguments passed to \link{polygon} when plotting the
+  background for the ticks.}
+}
+\author{Peter Solymos}
+\seealso{\link{rug}}
+\examples{
+ require(stats)
+ plot(density(faithful$eruptions,bw=0.15))
+ ruginv(faithful$eruptions,ticksize=-0.05)
+ ruginv(jitter(faithful$eruptions,amount=0.01),side=3,col="lightblue")
+}
+\keyword{misc}
diff --git a/man/seats.Rd b/man/seats.Rd
new file mode 100644
index 0000000..074e2ef
--- /dev/null
+++ b/man/seats.Rd
@@ -0,0 +1,22 @@
+\name{seats}
+\alias{seats}
+\title{Arrange N seats in M semicircular rows}
+\description{Compute seat positions in a semicircular parliament}
+\usage{seats(N, M, r0 = 2.5)}
+\arguments{
+ \item{N}{Total number of seats.}
+ \item{M}{Number of semicircular arcs on which to distribute the seats.}
+ \item{r0}{Radius of the inner arc in user units.}
+}
+\value{
+ A data frame including:
+ \item{x}{The x positions of the seats to be plotted on semi-circular
+  arcs.}
+ \item{y}{The y positions of the seats to be plotted on semi-circular
+  arcs.}
+ \item{r}{The row numbers for each seat.}
+ \item{theta}{The angle of each seat, going from pi to zero radians.}
+}
+\author{Duncan Murdoch and Barry Rowlingson}
+\seealso{\link{election}}
+\keyword{misc}
diff --git a/man/size_n_color.Rd b/man/size_n_color.Rd
new file mode 100644
index 0000000..27dbe0b
--- /dev/null
+++ b/man/size_n_color.Rd
@@ -0,0 +1,83 @@
+\name{size_n_color}
+\alias{size_n_color}
+\title{Display circles with specified size and color}
+\description{Display a plot of circles at specified locations, each with a
+ specified size and color.}
+\usage{
+ size_n_color(x=NULL,y,size,sizefun="sqrt",col,main="",
+  xlim=NA,xlab="",xat=NULL,xaxlab=NULL,xcex=1,xlas=0,xgrid=FALSE,
+  ylim=NA,ylab="",yat=NULL,yaxlab=NULL,ycex=1,ylas=1,ygrid=TRUE,
+  mar=c(5,4,4,2),boxit=TRUE,add=FALSE,...)
+}
+\arguments{
+ \item{x,y}{Vectors or matrices of x and y positions for the symbols.}
+ \item{size}{Sizes for the symbols expressed as numbers.}
+ \item{sizefun}{The function to use for transforming the values to radii
+  of circles. Square root gives areas proportional to the values.}
+ \item{col}{Colors for the symbols (see Details).}
+ \item{main}{Title for the plot.}
+ \item{xlim,ylim}{Explicit x and y limits for the plot}.
+ \item{xlab,ylab}{Labels for the x and y axes.}
+ \item{xat,yat}{Where to place the ticks and tick labels on the axes.}
+ \item{xaxlab,yaxlab}{Tick labels for the x and y axes.}
+ \item{xcex,ycex}{Character expansions for the axis tick labels.}
+ \item{xlas,ylas}{Orientation for the axis tick labels (see \samp{par}).}
+ \item{xgrid,ygrid}{Whether to display a grid along the x or y direction.}
+ \item{mar}{Margins for the plot (see Details).}
+ \item{boxit}{Whether to draw a box around the plot.}
+ \item{add}{Whether to draw a new plot (FALSE) or add symbols to an existing
+  plot (TRUE).}
+ \item{...}{Additional arguments passed to \samp{plot}.}
+}
+\details{
+ \samp{size_n_color} plots circles centered on the \samp{x} and \samp{y}
+ coordinates. The size and color of the circles may also be specified
+ individually, allowing four dimensions of variation to be displayed on the
+ plot.
+
+ \samp{size_n_color} may also be used to display a "visual table" as in the second
+ example. Here the x and y coordinates are used to associate the symbols with
+ two categorical variables, underlying cause of death and year of observation.
+ If the x values are not passed to the function, it will try to space out the
+ circles evenly in a representation of the matrix. If the matrix is not square,
+ use a plotting device that has about the same proportion of height and width as
+ the matrix.
+}
+\value{nil}
+\keyword{misc}
+\author{Jim Lemon}
+\seealso{\link{plot}, \link{points}, \link{par}}
+\examples{
+ meantemp<-c(19,22,25,29,21,20,16,27,23,26)
+ totalrain<-c(174,152,196,120,177,183,92,153,161,85)
+ numpumpkin<-c(53,47,61,63,38,42,48,71,66,29)
+ meanwt<-c(1.5,2.3,2.8,1.9,2.4,1.8,2.6,2.2,1.7)
+ size_n_color(meantemp,totalrain,meanwt/5,NA,xlim=c(15,30),
+  color.scale(numpumpkin,c(0.8,0),c(0.8,1),0),
+  xlab="Temperature (degrees C)",ylab="Rainfall (mm)",
+  main="Number and weight of pumpkins by temperature and rainfall",
+  xat=seq(15,30,by=5),yat=seq(80,200,by=20))  
+ color.legend(15,55,18.5,60,seq(40,70,by=10),
+  rect.col=color.scale(seq(40,70,by=10),c(0.8,0),c(0.8,1),0))
+ points(15:18,rep(126,4),cex=seq(1.5,3.0,by=0.5))
+ text(15:19,rep(134,5),c("1.5","2.0","2.5","3.0","kg"))
+ par(xpd=TRUE)
+ text(13.5,60,"Number of\npumpkins")
+ par(xpd=FALSE)
+ # now display a "visual table" of delayed registrations by underlying cause of
+ # death and year of observation. The sizes of the circles represent the log of
+ # the number of deaths and the colors represent the percentage of deaths that
+ # occurred in the year prior to registration or earlier
+ data(death_reg)
+ size_n_color(x=matrix(rep(1996:2010,each=22),nrow=22),
+  y=matrix(rep(1:22,15),nrow=22),size=t(death_reg[[1]])/200,
+  col=color.scale(t(death_reg[[2]]),c(0,0.8,1),c(1,0.2,0),0),
+  ylim=c(1,22),main="Delayed registrations by ICD chapter",
+  xlab="Year",xaxlab=1996:2010,xat=1996:2010,xcex=0.8,
+  yaxlab=colnames(death_reg[[1]]),ycex=0.8,ygrid=TRUE,mar=c(5,6,4,2))
+ color.legend(1994,-3.5,2000,-2.5,seq(0,50,by=10),cex=0.8,
+  rect.col=color.scale(seq(0,50,by=10),c(0,0.8,1),c(1,0.2,0),0))
+ par(xpd=TRUE)
+ text(1993.4,-2.5,"Pct.\nslow",cex=0.8)
+ par(xpd=FALSE)
+}
diff --git a/man/sizeplot.Rd b/man/sizeplot.Rd
new file mode 100755
index 0000000..0df5f63
--- /dev/null
+++ b/man/sizeplot.Rd
@@ -0,0 +1,41 @@
+\name{sizeplot}
+\alias{sizeplot}
+\title{Plot with repeated symbols by size}
+\description{
+ Plots a set of (x,y) data with repeated points denoted by larger
+ symbol sizes
+}
+\usage{
+ sizeplot(x, y, scale=1, pow=0.5, powscale=TRUE, size=c(1,4), add=FALSE, ...)
+}
+\arguments{
+ \item{x}{x coordinates of data}
+ \item{y}{y coordinates of data}
+ \item{scale}{scaling factor for size of symbols}
+ \item{pow}{power exponent for size of symbols}
+ \item{powscale}{(logical) use power scaling for symbol size?}
+ \item{size}{(numeric vector) min and max size for scaling, if powscale=FALSE}
+ \item{add}{(logical) add to an existing plot?}
+ \item{\dots}{other arguments to \samp{plot()} or \samp{points()}}
+}
+\details{
+ Most useful for plotting (e.g.) discrete data, where repeats are
+ likely.  If all points are repeated equally, gives a warning.  The
+ size of a point is given by \eqn{scale*n^pow}, where n is the number of
+ repeats, if powscale is TRUE, or it is scaled between size[1] and size[2],
+ if powscale is FALSE.
+}
+\value{
+ A plot is produced on the current device, or points are added to the
+ current plot if \samp{add=TRUE}.
+}
+\author{Ben Bolker}
+\seealso{\link{symbols}}
+\examples{
+ x <- c(0.1,0.1,0.1,0.1,0.1,0.2,0.2,0.2,0.2,0.3,0.3)
+ y <- c( 1,  1,  1,  1,  2,  2,  2,  3,  3,  4,  5 )
+ plot(x,y)
+ sizeplot(x,y)
+ sizeplot(x,y,pch=2)
+}
+\keyword{hplot}
diff --git a/man/sizetree.Rd b/man/sizetree.Rd
new file mode 100644
index 0000000..2158430
--- /dev/null
+++ b/man/sizetree.Rd
@@ -0,0 +1,106 @@
+\name{sizetree}
+\alias{sizetree}
+\title{Display a hierarchical breakdown of disjunct categories}
+\description{Display a data frame in which the values in each successive
+ column represent subcategories of the previous column as stacked
+ rectangles.}
+\usage{
+ sizetree(x,left=0,top,right=1,lastcenter=NA,showval=TRUE,showcount=TRUE,
+  stacklabels=TRUE,firstcall=TRUE,col=NULL,border=NA,toplab=NULL,base.cex=1,
+  ...)
+}
+\arguments{
+ \item{x}{A data frame in which each successive column represents
+  subcategories of the previous column.}
+ \item{left}{The left edge of the current stack of rectangles in user units.}
+ \item{top}{The top of the current stack of rectangles in user units.}
+ \item{right}{The right edge of the current stack of rectangles in user units.}
+ \item{lastcenter}{The center of the previous rectangle from which the next
+  breakdown of categories arises. There is almost no reason to change it.}
+ \item{showval}{Whether to display the values representing the categories.}
+ \item{showcount}{Whether to display the count for the categories.}
+ \item{stacklabels}{Whether to display the names of the dataframe beneath
+  the stacked rectangles.}
+ \item{firstcall}{A flag for the function - do not alter this.}
+ \item{col}{Optional fill colors for the rectangles. See Details}
+ \item{border}{Color for border around the rectangles. See details}
+ \item{toplab}{Optional labels to display a the top of each stack.}
+ \item{base.cex}{The base character expansion for the labels.}
+ \item{...}{additional arguments passed to \samp{plot}.}
+}
+\value{ nil }
+\details{
+ \samp{sizetree} displays disjunct hierarchical categories as stacked rectangles.
+ It accepts a data frame in which the values in the first column represent
+ categories, the values in the second column represent subcategories of the
+ first column, and so on. The first column will be displayed as a stack of
+ rectangles, the height of each proportional to the count for each category.
+ Each substack of rectangles in the second stack will represent the breakdown
+ of counts for its superordinate category and so on through the columns.
+ Empty categories are ignored and NAs will produce gaps, which will propagate
+ across subsequent stacks.
+ 
+ The user can simply pass the data frame, which should only contain columns that
+ are hierarchical categories (example 1). The colors will probably not be ideal.
+ The user can pass the same colors for the all levels (example 2). If this is
+ done, \samp{sizetree} will try to match colors to categories when
+ the number of categories is diminishing (e.g. some levels are missing in the
+ sub-categories) and the columns of \samp{x} are factors with the same levels in
+ the same order. This will work if the category labels are the same in each level,
+ but remember to add the names to the colors before passing them to the function.
+ This will not work if there are more categories in the lower levels. If \samp{col}
+ is a list, this is not done, and the user will have to work out the correct colors
+ for each level. This is particularly important when the category labels and the
+ number of categories is different in different levels (example 3).
+
+ In some sizetrees, the subcategory counts are very low compared to the overall
+ number of data objects. This results in rectangles that are very thin vertically.
+ One way to get better legibility of the labels is to use dark colors for the
+ rectangles, so that the labels are white, and no borders (set \samp{border} to NA).
+ The user can also select only part of the data frame \samp{x} to expand sections
+ of the sizetree as in the last example.
+
+ The labels are sized to fit the vertical extent of the bars. However, it is
+ possible that the labels may extend horizontally beyond the bar(s). The
+ \samp{base.cex} argument can be used to shrink the labels if this happens.
+ Remember that \samp{base.cex} will shrink all the labels, not just the ones
+ that are too wide.
+ 
+ The \samp{firstcall} argument is necessary for the function to initialize the
+ plot, as each breakdown involves a recursive call. If it is changed, the best
+ that can be expected is an uninformative plot.
+}
+\author{Jim Lemon}
+\seealso{\link{plot}}
+\examples{
+ cat1<-factor(sample(c("None","Low","Medium","High","Extreme"),40,TRUE),
+  levels=c("None","Low","Medium","High","Extreme"))
+ cat2<-factor(sample(c("None","Low","Medium","High"),40,TRUE),
+  levels=c("None","Low","Medium","High"))
+ cat3<-factor(sample(c("None","Low","High"),40,TRUE),
+  levels=c("None","Low","High"))
+ hcats<-data.frame(cat1,cat2,cat3)
+ # throw in a few NAs
+ hcats$cat1[10]<-NA
+ hcats$cat2[c(15,20)]<-NA
+ hcats$cat3[c(11,14,25)]<-NA
+ # first let sizetree work out the colors
+ sizetree(hcats,main="Sizetree with automatic colors")
+ # now see what happens with a list of the same colors for each level
+ bhcol<-c("#ff8080","#dddd80","#80ff80","#0000ff","#80dddd")
+ sizetree(hcats,col=list(bhcol,bhcol,bhcol),
+  main="Sizetree with the same colors each level")
+ # finally, specify different colors for categories with different labels
+ sexhaireye<-data.frame(sex=factor(sample(c("Male","Female"),50,TRUE)),
+  hair=factor(sample(c("Blond","Red","Brown","Black"),50,TRUE)),
+  eye=factor(sample(c("Gold","Green","Blue"),50,TRUE)))
+ shecol<-list(c("pink","lightblue"),c("#000000","#dddd00","#886600","#ee8800"),
+  c("blue","gold","green"))
+ sizetree(sexhaireye,main="Sex, hair and eye color",
+  col=shecol,toplab=c("Sex","Hair color","Eye color"))
+ # now expand the female part of the sizetree
+ sizetree(sexhaireye[sexhaireye[,1]=="Female",],
+  main="Sex, hair and eye color (Females only)",
+  col=shecol,toplab=c("Sex","Hair color","Eye color"))
+}
+\keyword{misc}
diff --git a/man/sliceArray.Rd b/man/sliceArray.Rd
new file mode 100644
index 0000000..ba550e7
--- /dev/null
+++ b/man/sliceArray.Rd
@@ -0,0 +1,30 @@
+\name{sliceArray}
+\alias{sliceArray}
+\title{Slice an array}
+\description{
+ Slices one dimension from an array by taking one element from the first dimension.
+}
+\usage{
+ sliceArray(x,slice)
+}
+\arguments{
+ \item{x}{An array}
+ \item{slice}{The index of the slice to take from the first dimension of the array.}
+}
+\details{
+ \samp{sliceArray} builds an extractor string containing the value of \samp{slice}
+ as the first element and as many commas as needed to match the dimensions of the
+ array. It then applies the extractor function to \samp{x} and returns the result. 
+ Note how the array "slice" swaps dimensions in the example.
+}
+\value{
+ The desired slice of the array.
+}
+\author{Jim Lemon}
+\seealso{\link{array}}
+\examples{
+ a1<-array(1:27,dim=c(3,3,3))
+ a1
+ sliceArray(a1,2)
+}
+\keyword{misc}
diff --git a/man/smoothColors.Rd b/man/smoothColors.Rd
new file mode 100755
index 0000000..2babe3d
--- /dev/null
+++ b/man/smoothColors.Rd
@@ -0,0 +1,34 @@
+\name{smoothColors}
+\alias{smoothColors}
+\title{Build a vector of color values}
+\usage{
+ smoothColors(...,alpha=NA)
+}
+\arguments{
+ \item{...}{an arbitrary sequence of color names and integers beginning
+  and ending with a color name.}
+ \item{alpha}{optional \samp{alpha} (transparency) value.}
+}
+\description{
+ \samp{smoothColors} calculates a sequence of colors. If two color names 
+  in the arguments are separated by a number, that number of interpolated
+  colors will be inserted between the two color endpoints. Any number of
+  color names and integers may be passed, but the last argument must be
+  a color name. If more than one integer appears between two color names,
+  only the first will be used in the interpolation and the others will be
+  ignored.
+}
+\value{A vector of hexadecimal color values as used by \samp{col}.}
+\note{
+ For more R functions that transform numeric values into
+ colors or produce colors that can be used to represent values, see the 
+ \pkg{colourschemes} package.
+}
+\author{Barry Rowlingson}
+\seealso{\link{color.gradient},\link{rgb}}
+\examples{
+ plot(1:10,main="Test opaque colors",type="n",axes=FALSE)
+ box()
+ rect(1:7,1:7,3:9,3:9,col=smoothColors("red",2,"green",2,"blue"))
+}
+\keyword{misc}
diff --git a/man/soil.texture.Rd b/man/soil.texture.Rd
new file mode 100755
index 0000000..d1097be
--- /dev/null
+++ b/man/soil.texture.Rd
@@ -0,0 +1,83 @@
+\name{soil.texture}
+\alias{soil.texture}
+\title{Soil texture triangle plot}
+\description{
+  Display a USDA soil texture triangle with optional grid, labels and
+  soil texture points.
+}
+\usage{
+soil.texture(soiltexture=NULL, main="", at=seq(0.1, 0.9, by=0.1),
+             axis.labels=c("percent sand", "percent silt",
+                           "percent clay"),
+             tick.labels=list(l=seq(10, 90, by=10), r=seq(10, 90, by=10),
+                              b=seq(10, 90, by=10)),
+             show.names=TRUE, show.lines=TRUE, col.names="gray",
+             bg.names=par("bg"), show.grid=FALSE, col.axis="black",
+             col.lines="gray", col.grid="gray", lty.grid=3,
+             show.legend=FALSE, label.points=FALSE, point.labels=NULL,
+             col.symbols="black", pch=par("pch"), \dots)
+}
+\arguments{
+ \item{soiltexture}{Matrix of soil textures where each row is a
+  soil sample and three columns contain the proportions of the
+  components sand, silt and clay in the range 0 to 1 or
+  percentages in the range 0 to 100.}
+ \item{main}{The title of the soil texture plot. Defaults to nothing.}
+ \item{at}{Positions on the three axes where ticks will be drawn.}
+ \item{axis.labels}{Labels for the axes.}
+ \item{tick.labels}{The tick labels for the three axes.}
+ \item{show.names}{Logical - whether to show the names of different
+  soil types within the soil triangle.}
+ \item{show.lines}{Logical - whether to show the boundaries of the
+  different soil types within the soil triangle.}
+ \item{col.names}{Color of the soil names. Defaults to gray.}
+ \item{bg.names}{Color to use when drawing a blank patch for the names
+  of soil types.}
+ \item{show.grid}{Logical - whether to show grid lines at each 10%
+  level of each soil component.}
+ \item{col.axis}{Color of the triangular axes, ticks and labels.}
+ \item{col.lines}{Color of the boundary lines. Defaults to gray.}
+ \item{col.grid}{Color of the grid lines. Defaults to gray.}
+ \item{lty.grid}{Type of line for the grid. Defaults to dashed.}
+ \item{show.legend}{Logical - whether to display a legend.}
+ \item{label.points}{Logical - whether to call
+  \link{thigmophobe.labels} to label the points.}
+ \item{point.labels}{Optional labels for the points or legend.}
+ \item{col.symbols}{Color of the symbols representing each value.}
+ \item{pch}{Symbols to use in plotting values.}
+ \item{\dots}{Additional arguments passed to \link{triax.points}
+  and then \samp{points}.}
+}
+\details{
+ \samp{soil.texture} displays a triangular plot area on which soil
+ textures defined as proportions of sand, silt and clay can be plotted.
+ Optional grid, vertex labels, soil type divisions and names may also
+ be displayed. If a matrix of soil textures is present, these will be
+ plotted.
+}
+\value{If \samp{soiltexture} was included, a list of the \samp{x,y}
+ positions of the soil types plotted. If not, nil.
+}
+\note{This is now a special case of \samp{triax.plot}.}
+\author{Sander Oom, Jim Lemon, and Michael Toews}
+\references{
+ U.S. Department of Agriculture, Natural Resources Conservation Service,
+ 2007. \emph{National Soil Survey Handbook}, title 430-VI.//
+ \url{http://www.nrcs.usda.gov/wps/portal/nrcs/detail/soils/survey/class/taxonomy/?cid=nrcs142p2_053577}
+
+ U.S. Department of Agriculture, Natural Resources Conservation Service,
+ 2007. \emph{Soil Texture Calculator}//
+ \url{http://www.nrcs.usda.gov/wps/portal/nrcs/detail/soils/survey/class/taxonomy/?cid=nrcs142p2_053577}
+}
+\seealso{\link{get.soil.texture}, \link{triax.plot}}
+\examples{
+ data(soils)
+ soil.texture(main="NO DATA")
+ soil.texture(soils, main="DEFAULT", pch=2)
+ soil.texture(soils, main="LINES AND NAMES", show.lines=TRUE,
+  show.names=TRUE, pch=3)
+ soiltex.return<-soil.texture(soils[1:6,], main="GRID AND LEGEND",
+  show.grid=TRUE, pch=4, col.symbols=1:6, show.legend=TRUE)
+ par(soiltex.return$oldpar)
+}
+\keyword{misc}
diff --git a/man/soil.texture.uk.Rd b/man/soil.texture.uk.Rd
new file mode 100755
index 0000000..16f907d
--- /dev/null
+++ b/man/soil.texture.uk.Rd
@@ -0,0 +1,88 @@
+\name{soil.texture.uk}
+\alias{soil.texture.uk}
+\title{Soil texture triangle plot using UK conventions}
+\description{
+  Display a UK style soil texture triangle with optional grid, labels and
+  soil texture points.
+}
+\usage{
+ soil.texture.uk(soiltexture = NULL, main = "",at = seq(0.1, 0.9, by = 0.1),
+  axis.labels = c("percent sand", "percent silt", "percent clay"),
+  tick.labels = list(l = seq(10, 90, by = 10), r = seq(10, 90, by = 10),
+  b = seq(10, 90, by = 10)), show.names = TRUE,
+  show.lines = TRUE, col.names = "gray", bg.names = par("bg"),
+  show.grid = FALSE, col.axis = "black", col.lines = "gray",
+  col.grid = "gray", lty.grid = 3, show.legend = FALSE, label.points = FALSE,
+  point.labels = NULL, col.symbols = "black", pch = par("pch"),
+  h1 = NA, h3 = NA, t1 = NA, t3 = NA, lwduk = 2, xpos = NA, ypos = NA,
+  snames = NA, cexuk = 1.1, ...)
+}
+\arguments{
+ \item{soiltexture}{Matrix of soil textures where each row is a
+  soil sample and three columns containing the percentages of the
+  components sand, silt and clay in the range 0 to 100.}
+ \item{main}{The title of the soil texture plot. Defaults to nothing.}
+ \item{at}{Positions on the three axes where ticks will be drawn.}
+ \item{axis.labels}{Labels for the axes.}
+ \item{tick.labels}{The tick labels for the three axes.}
+ \item{show.names}{Logical - whether to show the names of different
+  soil types within the soil triangle.}
+ \item{show.lines}{Logical - whether to show the boundaries of the
+  different soil types within the soil triangle.}
+ \item{col.names}{Color of the soil names. Defaults to gray.}
+ \item{bg.names}{Color to use when drawing a blank patch for the names
+  of soil types.}
+ \item{show.grid}{Logical - whether to show grid lines at each 10%
+  level of each soil component.}
+ \item{col.axis}{Color of the triangular axes, ticks and labels.}
+ \item{col.lines}{Color of the boundary lines. Defaults to gray.}
+ \item{col.grid}{Color of the grid lines. Defaults to gray.}
+ \item{lty.grid}{Type of line for the grid. Defaults to dashed.}
+ \item{show.legend}{Logical - whether to display a legend.}
+ \item{label.points}{Logical - whether to call
+  \link{thigmophobe.labels} to label the points.}
+ \item{point.labels}{Optional labels for the points or legend.}
+ \item{col.symbols}{Color of the symbols representing each value.}
+ \item{pch}{Symbols to use in plotting values.}
+ \item{h1,h3,t1,t3}{Points used in drawing boundaries for soil types.}
+ \item{lwduk}{Line width for the boundaries}
+ \item{xpos,ypos}{Positions for the soil type labels.}
+ \item{snames}{Soil type labels.}
+ \item{cexuk}{Character expansion for the soil type labels.}
+ \item{...}{Additional arguments passed to \link{triax.points}
+  and then \samp{points}.}
+}
+\details{
+ \samp{soil.texture.uk} displays a triangular plot area on which soil
+ textures defined as proportions of sand, silt and clay can be plotted.
+ It is similar to the \samp{soil.texture} function but uses the UK
+ display conventions.
+}
+\value{If \samp{soiltexture} was included, a list of the \samp{x,y}
+ positions of the soil types plotted. If not, nil.
+}
+\author{Julian Stander}
+\seealso{\link{triax.plot}}
+\examples{
+ soils.sw.percent<-data.frame(
+  Sand=c(67,67,66,67,36,25,24,59,27,9,8,8,20,
+  45,50,56,34,29,39,41,94,98,97,93,96,99),
+  Silt=c(17,16,9,8,39,48,54,27,46,70,68,68,66,
+  34,30,24,48,53,46,48,2,2,2,4,1,1),
+  Clay=c(16,17,25,25,25,27,22,14,27,21,24,24,
+  14,21,20,20,18,18,15,11,4,0,1,3,3,0))
+ soils.sw.cols <- c(1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3,
+  3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6)
+ soils.sw.names <- c("Ardington","Astrop","Atrim",
+  "Banbury","Beacon","Beckfoot")
+ soil.texture.uk(soils.sw.percent,
+  main = "Ternary Diagram for Some Soils from South West England",
+  col.lines = "black", col.names = "black", show.grid = TRUE,
+  col.grid = "blue", lty.grid = 2,  pch = 16, cex = 1.0,
+  col.symbols = soils.sw.cols, h1 = NA, h3 = NA, t1 = NA,
+  t3 = NA , lwduk = 2, xpos = NA, ypos = NA,
+  snames = NA, cexuk = 1.1)
+ legend("topleft", legend = soils.sw.names, col = 1:max(soils.sw.cols),
+  pch = 16, cex = 1.1, title = "Location", bty = "n")
+}
+\keyword{misc}
diff --git a/man/soils.Rd b/man/soils.Rd
new file mode 100755
index 0000000..1594476
--- /dev/null
+++ b/man/soils.Rd
@@ -0,0 +1,16 @@
+\name{soils}
+\alias{soils}
+\title{Soil texture data from 125 soils}
+\description{
+ A set of 125 soil texture measurements from soils from various parts of the
+  world.
+}
+\usage{
+ data(soils)
+}
+\source{
+ T.H. Skaggs, L.M. Arya, P.J. Shouse and B.P. Mohanty (2001)
+ Estimating Particle-Size Distribution from Limited Soil Texture Data.
+ Soil Science Society of America Journal 65:1038-1044.
+}
+\keyword{misc}
diff --git a/man/spread.labels.Rd b/man/spread.labels.Rd
new file mode 100755
index 0000000..830ad47
--- /dev/null
+++ b/man/spread.labels.Rd
@@ -0,0 +1,67 @@
+\name{spread.labels}
+\alias{spread.labels}
+\title{ Spread labels for irregularly spaced values }
+\description{
+ Places labels for irregularly spaced values in a regular staggered order
+}
+\usage{
+ spread.labels(x,y,labels=NULL,ony=NA,offsets=NA,between=FALSE,
+  linecol=par("fg"),srt=0,...)
+}
+\arguments{
+ \item{x,y}{x and y data values}
+ \item{labels}{text strings}
+ \item{ony}{Whether to force the labels to be spread horizontally
+  (FALSE) or vertically (TRUE). Defaults to whichever way the points are
+  most spread out.}
+ \item{offsets}{How far away from the data points to place the labels.
+  Defaults to one quarter of the plot span for all, staggered on each side.}
+ \item{between}{Whether to place the labels between two sets of points.}
+ \item{linecol}{Optional colors for the lines drawn to the points.}
+ \item{srt}{Rotation of the labels in degrees.}
+ \item{...}{additional arguments passed to \samp{text}.}
+}
+\details{
+ This function is mainly useful when labeling irregularly spaced data points
+ that are "spread out" along one dimension. It places the labels regularly
+ spaced and staggered on the long dimension of the data, drawing lines from
+ each label to the point it describes.
+ 
+ If \samp{between} is TRUE, the function expects two points for each label
+ and will attempt to place the labels between two vertical lines of points.
+ Lines will be drawn from the ends of each label to the two corresponding
+ points.
+ 
+ If spreading labels horizontally, the user may wish to rotate the labels by
+ 90 degrees (\samp{srt=90}). If long labels run off the edge of the plot,
+ increase the \samp{xlim} for extra room.
+}
+\value{nil}
+\author{Jim Lemon}
+\references{
+ Cooke, L.J. & Wardle, J. (2005) Age and gender differences in
+ children's food preferences. British Journal of Nutrition, 93: 741-746.
+}
+\seealso{\samp{text}, \samp{spread.lab (TeachingDemos)}}
+\examples{
+ # spread labels out in the x dimension using defaults
+ x<-sort(rnorm(10))
+ y<-rnorm(10)/10
+ plot(x,y,ylim=c(-1,1),type="p")
+ nums<-c("one","two","three","four","five","six","seven","eight","nine","ten")
+ spread.labels(x,y,nums)
+ # food preferences of children by sex (Cooke & Wardle, 2005)
+ fpkids<-data.frame(Food=c("Fatty/sugary","Fruit","Starchy","Meat",
+  "Proc.meat","Eggs","Fish","Dairy","Vegetables"),
+  Female=c(4.21,4.22,3.98,3.57,3.55,3.46,3.34,3.26,3.13),
+  Male=c(4.35,4.13,4.02,3.9,3.81,3.64,3.45,3.27,2.96))
+ plot(rep(1,9),fpkids$Female,xlim=c(0.8,2.2),
+  ylim=range(c(fpkids$Female,fpkids$Male)),xlab="Sex",xaxt="n",
+  ylab="Preference rating",main="Children's food preferences by sex",
+  col="red")
+ axis(1,at=1:2,labels=c("Female","Male"))
+ points(rep(2,9),fpkids$Male,col="blue",pch=2)
+ spread.labels(rep(1:2,each=9),c(fpkids$Female,fpkids$Male),
+  fpkids$Food,between=TRUE,linecol=c("red","blue"))
+}
+\keyword{misc}
diff --git a/man/spreadout.Rd b/man/spreadout.Rd
new file mode 100755
index 0000000..49704af
--- /dev/null
+++ b/man/spreadout.Rd
@@ -0,0 +1,38 @@
+\name{spreadout}
+\alias{spreadout}
+\title{Spread out a vector of numbers to a minimum interval}
+\description{
+ Spread out a vector of numbers so that there is a minimum interval
+ between any two numbers when in ascending or descending order.
+}
+\usage{
+ spreadout(x,mindist)
+}
+\arguments{
+ \item{x}{A numeric vector which may contain NAs.}
+ \item{mindist}{The minimum interval between any two values when in ascending
+  or descending order.}
+}
+\details{
+ \samp{spreadout} starts at or near the middle of the vector and increases the
+ intervals between the ordered values. NAs are preserved. \samp{spreadout}
+ first tries to spread groups of values with intervals less than \samp{mindist}
+ out neatly away from the mean of the group. If this doesn't entirely succeed,
+ a second pass that forces values away from the middle is performed.
+
+ \samp{spreadout} is currently used to avoid overplotting of axis tick labels
+ where they may be close together.
+}
+\value{
+ On success, the spread out values. If there are less than two valid
+ values, the original vector is returned.
+}
+\author{Jim Lemon}
+\examples{
+ spreadout(c(1,3,3,3,3,5),0.2)
+ spreadout(c(1,2.5,2.5,3.5,3.5,5),0.2)
+ spreadout(c(5,2.5,2.5,NA,3.5,1,3.5,NA),0.2)
+ # this will almost always invoke the brute force second pass
+ spreadout(rnorm(10),0.5)
+}
+\keyword{misc}
diff --git a/man/stackpoly.Rd b/man/stackpoly.Rd
new file mode 100755
index 0000000..1858e0c
--- /dev/null
+++ b/man/stackpoly.Rd
@@ -0,0 +1,80 @@
+\name{stackpoly}
+\alias{stackpoly}
+\title{
+ Display the columns of a matrix or data frame as stacked polygons
+}
+\description{
+ Plot one or more columns of numeric values as the top edges of polygons
+ instead of lines.
+}
+\usage{
+ stackpoly(x,y=NULL,main="",xlab="",ylab="",xat=NA,xaxlab=NA,
+  xlim=NA,ylim=NA,lty=1,lwd=1,border=NA,col=NULL,staxx=FALSE,stack=FALSE,
+  axis2=TRUE,axis4=TRUE,padj=0,...)
+}
+\arguments{
+ \item{x}{A numeric data frame or matrix with the \samp{x} values. If
+  \samp{y} is NULL, these will become the \samp{y} values and the \samp{x}
+  positions will be the integers from 1 to dim(x)[1].}
+ \item{y}{The \samp{y} values.}
+ \item{main}{The title for the plot.}
+ \item{xlab,ylab}{x and y axis labels for the plot.}
+ \item{xat}{Where to put the optional xaxlabs.}
+ \item{xaxlab}{Optional labels for the x positions.}
+ \item{xlim}{Optional x limits.}
+ \item{ylim}{Optional y limits.}
+ \item{lty}{Line type for the polygon borders.}
+ \item{lwd}{Line width for the polygon borders.}
+ \item{border}{Color for the polygon borders.}
+ \item{col}{Color to fill the polygons. If NULL, \samp{rainbow} will be
+  called to generate the colors. If NA, the polygons will not be filled.}
+ \item{staxx}{Whether to call \samp{staxlab} to stagger the x axis labels.}
+ \item{stack}{Whether to stack the successive values on top of each other.}
+ \item{axis2}{Whether to display the left ordinate on the plot.}
+ \item{axis4}{Whether to display the right ordinate on the plot.}
+ \item{padj}{Vertical justfication of the x axis labels, defaulting to "top".
+  Can be a vector with an element for each label.}
+ \item{...}{Additional arguments passed to \samp{plot}.}
+}
+\value{
+ nil
+}
+\details{
+ \samp{stackpoly} is similar to a line plot with the area under the
+ lines filled with color(s). Ideally, each successive set of y values
+ is greater than the values in the previous set so that the polygons 
+ form a rising series of crests. If \samp{stack} is TRUE, this is not a
+ problem unless some values of \samp{x} are negative.
+ 
+ If \samp{x} or \samp{y} is a vector, not a matrix or list, the values will
+ be displayed as a "waterfall plot".
+
+ The options for \samp{axis2} and \samp{axis4} can be used to produce
+ panel plots. See the last example.
+}
+\author{Jim Lemon and Thomas Petzoldt (waterfall plot option) - thanks to
+ Phil Novack-Gottshall for the mismatched x and y fix}
+\seealso{\link{polygon}}
+\examples{
+ testx<-matrix(abs(rnorm(100)),nrow=10)
+ stackpoly(matrix(cumsum(testx),nrow=10),main="Test Stackpoly I",
+  xaxlab=c("One","Two","Three","Four","Five",
+  "Six","Seven","Eight","Nine","Ten"),border="black",staxx=TRUE)
+ stackpoly(testx,main="Test Stackpoly II",
+  xaxlab=c("One","Two","Three","Four","Five",
+  "Six","Seven","Eight","Nine","Ten"),border="black",
+  staxx=TRUE,stack=TRUE)
+ layout(matrix(1:2,nrow=1))
+ oldmar<-par(mar=c(5,4,4,0))
+ stackpoly(rev(sort(testx-mean(testx))),
+  main="Waterfall Plot (x-mean)",xat=seq(10,90,by=10),
+  xlab="Index",ylab="Value",lwd=3,col="green",border="black",
+  axis4=FALSE)
+ ylim<-par("usr")[3:4]
+ par(mar=c(5,0,4,4))
+ stackpoly(rev(sort((testx-mean(testx))/sd(as.vector(testx)))),
+  ylim=ylim,main="Waterfall Plot ((x-mean)/sd)",xat=seq(10,90,by=10),
+  xlab="Index",lwd=3,col="lightblue",border="black",axis2=FALSE)
+ par(oldmar)
+}
+\keyword{misc}
diff --git a/man/staircase.plot.Rd b/man/staircase.plot.Rd
new file mode 100755
index 0000000..2ab0008
--- /dev/null
+++ b/man/staircase.plot.Rd
@@ -0,0 +1,75 @@
+\name{staircase.plot}
+\alias{staircase.plot}
+\title{Display a staircase plot}
+\description{
+ Displays a plot showing a sequence of changing totals and increments as
+ successive linked bars.
+}
+\usage{
+ staircase.plot(heights,totals=NA,labels=NULL,halfwidth=0.3,main="",
+ mar=NA,total.col="blue",inc.col=NA,bg.col=NA,direction="e",las=1,
+ display.height=TRUE,stagger=FALSE,cex=par("cex"),prefix="",suffix="",...)
+}
+\arguments{
+ \item{heights}{vector of numeric values or a matrix or data frame with at least
+  two columns. The first column must be numeric and the second may be numeric or
+  logical.}
+ \item{totals}{A vector of logicals or zero/non-zero values indicating whether
+  the corresponding height is a total (TRUE) or an increment (FALSE).}
+ \item{labels}{An optional vector of labels for the bars.}
+ \item{halfwidth}{Half of the width of a bar as a proportion. See Details.}
+ \item{main}{A title for the plot.}
+ \item{mar}{Margins for the plot. Defaults to 10 on the baseline axis, 3 on the
+  top and 1 on the other two sides.}
+ \item{total.col}{Color(s) for the bars representing successive totals.}
+ \item{inc.col}{Color(s) for the bars representing increments.}
+ \item{bg.col}{The background color for the plot.}
+ \item{direction}{Direction in which the bars should be presented. See Details.}
+ \item{las}{Orientation for the bar labels. See \samp{par}.}
+ \item{display.height}{Whether to display the totals and increments at the upper
+  ends of the bars. Defaults to TRUE.}
+ \item{stagger}{Whether to stagger the labels to avoid overlap.}
+ \item{cex}{The usual character expansion value.}
+ \item{prefix}{A prefix to the numbers displayed next to the bars (e.g. $).}
+ \item{suffix}{A suffix as for prefix (e.g. \%).}
+ \item{...}{arguments passed to \samp{plot}.}
+}
+\value{nil}
+\details{
+ Displays a plot representing successive changes in counts or values. For example,
+ if a research study attempts to contact a certain number of people and some
+ cannot be contacted, some decline to participate, some are ineligible, the final
+ sample will be smaller than the initial contact list. The first value will be the
+ total of attempts, there will be a number of decrements, and the last value will
+ be the actual sample. There may be intermediate totals specified. This produces
+ a visual display of the sampling procedure. See the example.
+
+ The bars are placed at integer values on the axis representing the succession of
+ counts or values. The width of the bars is determined by the argument
+ \samp{halfwidth}. This defaults to 0.3, meaning that the bar extends 0.3 to each
+ side, so that the proportion of bar to space is 0.6 to 0.4. The succession of
+ bars is determined by the \samp{direction} argument. The default is "e" (east),
+ meaning that the first bar is at the left of the plot and subsequent bars are
+ placed to the right. The other three possibilities follow the conventional
+ compass layout.
+
+ The \samp{prefix} and \samp{suffix} arguments allow the user to specify units
+ for the numbers displayed next to the bars. If a single value is passed, all
+ numbers will get the same prefix or suffix. Different prefixes or suffixes for 
+ each number can be passed as vectors.
+
+ The \samp{getFigCtr} function is called to center the plot title in the figure
+ region as the plot area is typically off center.
+}
+\author{Jim Lemon}
+\seealso{\link{plot}, \link{getFigCtr}}
+\examples{
+ sample_size<-c(500,-72,428,-94,334,-45,289)
+ totals<-c(TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE)
+ labels<-c("Contact list","Uncontactable","","Declined","","Ineligible",
+  "Final sample")
+ staircase.plot(sample_size,totals,labels,
+  main="Acquisition of the sample (staircase.plot)",
+  total.col="gray",inc.col=2:4,bg.col="#eeeebb",direction="s")
+}
+\keyword{misc}
diff --git a/man/starPie.Rd b/man/starPie.Rd
new file mode 100644
index 0000000..32b654b
--- /dev/null
+++ b/man/starPie.Rd
@@ -0,0 +1,68 @@
+\name{starPie}
+\alias{starPie}
+\title{A pie-like graphic object}
+\usage{
+ starPie(x,y,radext,values,maxval=NA,border=par("fg"),col=NA,prop.area=FALSE,
+  label="",labelpos=1)
+}
+\description{
+ Display a polygon with each sector proportional to a vector of numeric values.
+}
+\arguments{
+ \item{x,y}{The coordinate position for the center of the starPie.}
+ \item{radext}{The maximum distance from the center of the starPie to one vertex of
+  the polygon.}
+ \item{values}{A vector of numeric values.}
+ \item{maxval}{A maximum value for scaling the values to the radius. If NA, the
+  maximum value in \samp{values} will be used.}
+ \item{border}{The color to use for the borders of the polygon sectors.}
+ \item{col}{The color(s) to use for the fills of the polygon.}
+ \item{prop.area}{Whether to scale the values to the area (TRUE) or the
+  radial extent (FALSE) of the polygon sectors.}
+ \item{label}{Optional text labels for the starPies.}
+ \item{labelpos}{Positions of the labels relative to the starPies.}
+}
+\value{nil}
+\details{
+ \samp{starPie} displays a polygon centered on the \samp{x,y} position having
+ sectors of equal angular extent. The radial extent of each sector
+ is proportional to the values in the numeric vector \samp{lengths}. If the
+ \samp{prop.area} argument is TRUE, the proportion is based on the area of the
+ sector, and if \samp{prop.area} is FALSE, the proportion is on the radial extent.
+ As the function is intended to exaggerate the differences between different
+ starPies, the default produces sectors proportional to the squares of the
+ \samp{lengths}.
+
+ \samp{starPie} is intended to display a visual analog of the relative value of
+ matched attributes of a number of similar objects or groups. Thus objects having
+ similar attributes will produce similar looking starPies. When constructing such
+ a matrix, it is necessary for \samp{maxval} to be specified, usually as the
+ overall maximum value in any of the attribute value vectors. If \samp{maxval} is
+ not specified in such a situation, only the relative values within each vector
+ will determine the radial extents of each starPie. There appears to be no reason
+ to have different sector colors for different objects, but the user can display
+ more than one set of starPies on a plot with different sector colors if
+ necessary.
+
+ \samp{starPie} calls \samp{getYmult} to automatically adjust for both the aspect
+ and coordinate ratio of the plot.
+}
+\author{Jim Lemon}
+\examples{
+ date_mat<-data.frame(sex=rep(c("M","F"),each=10),
+  names=c("Abe","Bob","Col","Dave","Eddie","Frank","Geoff","Harry","Igor","Jack",
+  "Alice","Betty","Clare","Dora","Eva","Fran","Grace","Hilda","Iris","Joan"),
+  eating=sample(0:100,20),dancing=sample(0:100,20),movies=sample(0:100,20),
+  reading=sample(0:100,20),travel=sample(0:100,20))
+ plot(0,xlim=c(0.5,10.5),ylim=c(0,3),type="n",axes=FALSE,xlab="",ylab="Sex",
+  main="Date matching matrix")
+ par(xpd=TRUE)
+ legend(0.7,-0.3,c("Eat out","Dance","Movies","Read","Travel"),fill=rainbow(5),
+  ncol=5)
+ par(xpd=FALSE)
+ box()
+ axis(2,at=c(0.9,2.4),labels=c("Male","Female"))
+ starPie(x=rep(1:10,2),y=rep(c(0.9,2.4),each=10),radext=0.5,
+  values=as.matrix(date_mat[,3:7]),label=as.character(date_mat[["names"]]))
+}
+\keyword{misc}
diff --git a/man/staxlab.Rd b/man/staxlab.Rd
new file mode 100755
index 0000000..66fe987
--- /dev/null
+++ b/man/staxlab.Rd
@@ -0,0 +1,51 @@
+\name{staxlab}
+\alias{staxlab}
+\title{ Place staggered or angled labels on an axis }
+\description{
+ Places labels on an axis in a regular staggered order or at an angle
+}
+\usage{
+ staxlab(side=1,at,labels,nlines=2,top.line=0.5,line.spacing=0.8,
+  srt=NA,ticklen=0.03,adj=1,...)
+}
+\arguments{
+ \item{side}{axis on which to place the labels, as in \samp{axis}}
+ \item{at}{where to place the labels in user units, as in \samp{axis}}
+ \item{labels}{text strings}
+ \item{nlines}{How many lines to use to stagger the labels.}
+ \item{top.line}{Distance from the axis to place the first line of text.}
+ \item{line.spacing}{Spacing between lines of text labels.} 
+ \item{srt}{Text rotation.}
+ \item{ticklen}{Proportion of plot height in user units to place text
+  below the plot.}
+ \item{adj}{horizontal adjustment of the labels.}
+ \item{...}{Additional arguments to be passed to \samp{mtext} or \samp{text}.}
+}
+\note{
+ This function is mainly useful when either long axis labels or a large
+ number of labels are to be placed without overlapping. It staggers the 
+ labels along the axis specified. The user may wish to increase the space
+ beneath the plot using \samp{mar} before calling \samp{staxlab}. It is
+ probably only useful on the bottom or left side of the plot.
+
+ If \samp{srt} is not NA, the labels will be rotated \samp{srt} degrees
+ and placed below the plot. This method will only place labels at the
+ bottom. Note that this option only works on the lower and left axes.
+}
+\value{nil}
+\author{Jim Lemon (thanks to Tim Elwell-Sutton for the log axis fix)}
+\seealso{\link{mtext}}
+\examples{
+ x<-rnorm(12)
+ plot(x,axes=FALSE)
+ box()
+ months<-c("January","February","March","April","May","June",
+  "July","August","September","October","November","December")
+ staxlab(1,1:12,months)
+ plot(x,axes=FALSE)
+ box()
+ staxlab(1,1:12,months,srt=45)
+ ylabels<-round(seq(min(x),max(x),length.out=10),3)
+ staxlab(2,ylabels,ylabels,srt=45)
+}
+\keyword{misc}
diff --git a/man/std.error.Rd b/man/std.error.Rd
new file mode 100755
index 0000000..4b5f578
--- /dev/null
+++ b/man/std.error.Rd
@@ -0,0 +1,22 @@
+\name{std.error}
+\alias{std.error}
+\title{Calculate standard error of the mean}
+\description{
+ Calculates the standard error of the mean.
+}
+\usage{
+ std.error(x,na.rm)
+}
+\arguments{
+  \item{x}{A vector of numerical observations.}
+  \item{na.rm}{Dummy argument to match other functions.}
+}
+\details{
+ \samp{std.error} will accept a numeric vector.
+}
+\value{
+ The conventional standard error of the mean = sd(x)/sqrt(sum(!is.na(x)))
+}
+\author{Jim Lemon}
+\seealso{\link{sd}}
+\keyword{misc}
diff --git a/man/sumDendrite.Rd b/man/sumDendrite.Rd
new file mode 100755
index 0000000..e4263c4
--- /dev/null
+++ b/man/sumDendrite.Rd
@@ -0,0 +1,21 @@
+\name{sumDendrite}
+\alias{sumDendrite}
+\title{Sum the counts in the top level of a dendrite object}
+\description{Find the sum of the counts that are the first elements of each
+ list in the top level of a dendrite object.}
+\usage{ sumDendrite(x) }
+\arguments{
+ \item{x}{A list with a numeric value as the first element in each of its
+  toplevel elements.}
+}
+\details{
+ A \samp{dendrite} object is a possibly nested list of lists that contain the
+ counts and pointers to sublists in each list. Such an object describes the 
+ attributes of objects that can take on mutually exclusive attributes (that is,
+ belong to disjunct sets). \samp{sumDendrite} is a convenience function to get
+ the total number of objects that are so classified.
+}
+\value{The sum of the counts in the top level of lists.}
+\keyword{misc}
+\author{Jim Lemon}
+\seealso{\link{plot.dendrite}}
diff --git a/man/sumbrk.Rd b/man/sumbrk.Rd
new file mode 100644
index 0000000..e7f19cd
--- /dev/null
+++ b/man/sumbrk.Rd
@@ -0,0 +1,26 @@
+\name{sumbrk}
+\alias{sumbrk}
+\title{Count specified values in a vector}
+\description{
+ Counts the number of values in a vector that are equal to a specified value.
+}
+\usage{
+ sumbrk(x,trueval=TRUE,na.rm=TRUE)
+}
+\arguments{
+  \item{x}{a character, factor or numeric vector.}
+  \item{trueval}{the value to be matched in \samp{x}.}
+  \item{na.rm}{whether to remove NA values.}
+}
+\details{
+ \samp{sumbrk} counts the values in \samp{x} matching a specified value.
+ It is mainly to allow these sums to be calculated in the \samp{brkdnNest}
+ function.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{brkdnNest}}
+\examples{
+ sumbrk(sample(LETTERS,100,TRUE),trueval="M")
+}
+\keyword{misc}
diff --git a/man/symbolbarplot.Rd b/man/symbolbarplot.Rd
new file mode 100755
index 0000000..8e819cf
--- /dev/null
+++ b/man/symbolbarplot.Rd
@@ -0,0 +1,51 @@
+\name{symbolbarplot}
+\alias{symbolbarplot}
+\title{barplot filled with symbols}
+\description{
+ Produces a barplot where each piece of the barplot is filled with the
+ number of symbols equal to the size of the bar
+}
+\usage{
+ symbolbarplot(height,width=1,space=NULL,names.arg=NULL,
+  legend.text=NULL,beside=FALSE,horiz=FALSE,col=heat.colors(NR),
+  border=par("fg"),main=NULL,sub=NULL,xlab=NULL,ylab=NULL,xlim=NULL,
+  ylim=NULL,axes=TRUE,axisnames=TRUE,inside=TRUE,plot=TRUE,rel.width=0.8,
+  symbol="circles",symbbox=TRUE,debug=FALSE,...)
+}
+\arguments{
+  \item{height}{numeric vector or matrix of barplot heights}
+  \item{width}{width of bars}
+  \item{space}{space between bars}
+  \item{names.arg}{vector of names}
+  \item{legend.text}{vector of legend text}
+  \item{beside}{(logical) plot bars beside each other?}
+  \item{horiz}{(logical) horizontal barplot?}
+  \item{col}{vector of colors}
+  \item{border}{plot border?}
+  \item{main}{main title}
+  \item{sub}{subtitle}
+  \item{xlab}{x axis label}
+  \item{ylab}{y axis label}
+  \item{xlim}{x limits}
+  \item{ylim}{y limits}
+  \item{axes}{draw axes?}
+  \item{axisnames}{label horizontal axis?}
+  \item{inside}{draw lines dividing adjacent bars?}
+  \item{plot}{produce plot?}
+  \item{rel.width}{relative width of symbols}
+  \item{symbol}{which symbol to use}
+  \item{symbbox}{draw boxes for symbol boxes?}
+  \item{debug}{debug output?}
+  \item{\dots}{further arguments to multsymbolbox}
+}
+\value{
+ Nil
+}
+\note{This is a mostly a hack of barplot()}
+\author{Ben Bolker}
+\examples{
+ set.seed(1001)
+ bvals <- matrix(rpois(12,20),nrow=3)
+ b <- symbolbarplot(bvals)
+}
+\keyword{hplot}
diff --git a/man/symbolbox.Rd b/man/symbolbox.Rd
new file mode 100755
index 0000000..30c4867
--- /dev/null
+++ b/man/symbolbox.Rd
@@ -0,0 +1,39 @@
+\name{symbolbox}
+\alias{symbolbox}
+\title{Draw a box filled with symbols}
+\description{
+ Draws a box on the current figure that is filled with symbols
+ representing individual counts
+}
+\usage{
+ symbolbox(x1,y1,x2,y2,tot,relw=0.5,fg=par("fg"),bg=par("bg"),box=TRUE,
+  debug = TRUE,...)
+}
+\arguments{
+ \item{x1}{left side of box}
+ \item{y1}{bottom side of box}
+ \item{x2}{right side of box}
+ \item{y2}{top side of box}
+ \item{tot}{total number of symbols to put in the box}
+ \item{relw}{relative width (relative to height) of symbols}
+ \item{fg}{foreground color}
+ \item{bg}{background color}
+ \item{box}{(logical) draw box border?}
+ \item{debug}{debug output?}
+ \item{\dots}{additional arguments to polygon() for drawing box}
+}
+\details{
+ tries to automatically figure out appropriate scaling to fit symbols
+ into the box
+}
+\value{
+ none; draws on the current figure
+}
+\author{Ben Bolker}
+\seealso{\link{multsymbolbox}}
+\examples{
+ plot(1:10,1:10,type="n")
+ symbolbox(2,5,3,7,tot=20)
+ symbolbox(6,2,10,6,tot=50,fg="blue",bg="magenta")
+}
+\keyword{aplot}
diff --git a/man/tab.title.Rd b/man/tab.title.Rd
new file mode 100755
index 0000000..e6e21a5
--- /dev/null
+++ b/man/tab.title.Rd
@@ -0,0 +1,42 @@
+\name{tab.title}
+\alias{tab.title}
+\title{
+ Display the title of a plot as a colored tab
+}
+\description{
+ Display the title of a plot as a colored tab.
+}
+\usage{
+ tab.title(label,text.col=par("fg"),tab.col=par("bg"),border=par("fg"),
+  lwd=par("lwd"),cex=1.5,pad.mult=1.6,radius=0)
+}
+\arguments{
+ \item{label}{The title for the plot.}
+ \item{text.col}{The color for the title text.}
+ \item{tab.col}{The color for the tab fill.}
+ \item{border}{The color for the tab border.}
+ \item{lwd}{The line width for the border.}
+ \item{cex}{Character expansion for the title.}
+ \item{pad.mult}{How much higher to make the tab relative to the label.}
+ \item{radius}{What proportion of the tab corners to round off.}
+}
+\value{
+ nil
+}
+\details{
+ \samp{tab.title} displays the plot title in a colored tab. The tab can be
+ rounded at the upper corners by specifying the proportion of the tab
+ height to be rounded as a number between 0 and 1. If the tab is too high
+ to fit on the figure region, a warning will be displayed and the tab will
+ still be shown. 
+}
+\author{Jim Lemon}
+\seealso{\link{polygon}}
+\examples{
+ testx<-matrix(cumsum(rnorm(30)^2)+1,nrow=10)
+ stackpoly(testx,main="",
+  xaxlab=c("One","Two","Three","Four","Five",
+  "Six","Seven","Eight","Nine","Ten"),staxx=TRUE)
+ tab.title("Three Squiggly Lines",tab.col="yellow",radius=0.5)
+}
+\keyword{misc}
diff --git a/man/taylor.diagram.Rd b/man/taylor.diagram.Rd
new file mode 100755
index 0000000..db3052b
--- /dev/null
+++ b/man/taylor.diagram.Rd
@@ -0,0 +1,93 @@
+\name{taylor.diagram}
+\alias{taylor.diagram}
+\title{ Taylor diagram }
+\description{ Display a Taylor diagram}
+\usage{
+ taylor.diagram(ref,model,add=FALSE,col="red",pch=19,pos.cor=TRUE,
+  xlab="",ylab="",main="Taylor Diagram",show.gamma=TRUE,ngamma=3,
+  gamma.col=8,sd.arcs=0,ref.sd=FALSE,sd.method="sample",
+  grad.corr.lines=c(0.2,0.4,0.6,0.8,0.9),
+  pcex=1,cex.axis=1,normalize=FALSE,mar=c(5,4,6,6),...)
+}
+\arguments{
+ \item{ref}{numeric vector - the reference values.}
+ \item{model}{numeric vector - the predicted model values.}
+ \item{add}{whether to draw the diagram or just add a point.}
+ \item{col}{the color for the points displayed.}
+ \item{pch}{the type of point to display.}
+ \item{pos.cor}{whether to display only positive (\samp{TRUE}) or all
+  values of correlation (\samp{FALSE}).}
+ \item{xlab,ylab}{plot axis labels.}
+ \item{main}{title for the plot.}
+ \item{show.gamma}{whether to display standard deviation arcs around
+  the reference point (only for \samp{pos.cor=TRUE}).}
+ \item{ngamma}{the number of gammas to display (default=3).}
+ \item{gamma.col}{color to use for the gamma arcs (only with pos.cor=TRUE).}
+ \item{sd.arcs}{whether to display arcs along the standard deviation axes
+  (see Details).}
+ \item{ref.sd}{whether to display the arc representing the reference
+  standard deviation.}
+ \item{sd.method}{Whether to use the sample or estimated population SD.}
+ \item{grad.corr.lines}{the values for the radial lines for correlation
+  values (see Details).}
+ \item{pcex}{character expansion for the plotted points.}
+ \item{cex.axis}{character expansion for the axis text.}
+ \item{normalize}{whether to normalize the models so that the reference
+  has a standard deviation of 1.}
+ \item{mar}{margins - only applies to the \samp{pos.cor=TRUE} plot.}
+ \item{...}{Additional arguments passed to \samp{plot}.}
+}
+\details{
+ The Taylor diagram is used to display the quality of model predictions
+ against the reference values, typically direct observations.
+ 
+ A diagram is built by plotting one model against the reference,
+ then adding alternative model points. If \samp{normalize=TRUE} 
+ when plotting the first model, remember to set it to \samp{TRUE}
+ when plotting additional models.
+ 
+ Two displays are available. One displays the entire range of correlations
+ from -1 to 1. Setting \samp{pos.cor} to \samp{FALSE} will produce this
+ display. The -1 to 1 display includes a radial grid for the correlation
+ values. When \samp{pos.cor} is set to \samp{TRUE}, only the
+ range from 0 to 1 will be displayed. The \samp{gamma} lines and the arc at
+ the reference standard deviation are optional in this display.
+ 
+ Both the standard deviation arcs and the gamma lines are optional in the
+ \samp{pos.cor=TRUE} version. Setting \samp{sd.arcs} or \samp{grad.corr.lines}
+ to zero or FALSE will cause them not to be displayed. If more than one value is
+ passed for \samp{sd.arcs}, the function will try to use the values passed,
+ otherwise it will call \samp{pretty} to calculate the values.
+}
+\value{
+ The values of \samp{par} that preceded the function. This allows the
+ user to add points to the diagram, then restore the original values. This
+ is only necessary when using the 0 to 1 correlation range.
+}
+\references{
+ Taylor, K.E. (2001) Summarizing multiple aspects of model performance in a
+ single diagram. Journal of Geophysical Research, 106: 7183-7192.
+}
+\author{Olivier Eterradossi with modifications by Jim Lemon}
+\examples{
+ # fake some reference data
+ ref<-rnorm(30,sd=2)
+ # add a little noise
+ model1<-ref+rnorm(30)/2
+ # add more noise
+ model2<-ref+rnorm(30)
+ # display the diagram with the better model
+ oldpar<-taylor.diagram(ref,model1)
+ # now add the worse model
+ taylor.diagram(ref,model2,add=TRUE,col="blue")
+ # get approximate legend position
+ lpos<-1.5*sd(ref)
+ # add a legend
+ legend(lpos,lpos,legend=c("Better","Worse"),pch=19,col=c("red","blue"))
+ # now restore par values
+ par(oldpar)
+ # show the "all correlation" display
+ taylor.diagram(ref,model1,pos.cor=FALSE)
+ taylor.diagram(ref,model2,add=TRUE,col="blue")
+}
+\keyword{misc}
diff --git a/man/textbox.Rd b/man/textbox.Rd
new file mode 100755
index 0000000..341fa1d
--- /dev/null
+++ b/man/textbox.Rd
@@ -0,0 +1,67 @@
+\name{textbox}
+\alias{textbox}
+\title{Add text box}
+\description{
+ Add text to plot, justified, in a box
+}
+\usage{
+ textbox(x, y, textlist, justify=c('l','c','r'), cex=1, leading=0.5, box=TRUE,
+ adj=c(0,0), font=NULL, vfont=NULL, col=NULL, border=NULL, fill=NA, density=NULL,
+ angle=45, lty=par("lty"), lwd=par("lwd"), margin=0)
+}
+\arguments{
+ \item{x}{x position: a vector with min. and max. x-position}
+ \item{y}{y position: location of the top of the box}
+ \item{textlist}{a vector of text strings}
+ \item{justify}{x alignment: 'l'=left, 'c'=center, 'r'=right.}
+ \item{cex}{character expansion}
+ \item{leading}{inter-line spacing}
+ \item{box}{whether to draw a box around the text}
+ \item{adj}{adjustment for x and y position, default is no adjustment,
+  see Details}
+ \item{font}{text font, see Details}
+ \item{vfont}{text font, see Details}
+ \item{col}{text color}
+ \item{border}{box border color}
+ \item{fill}{box fill color}
+ \item{density}{box shading line density, see Details}
+ \item{angle}{box shading line angle, see Details}
+ \item{lty}{box border and shading line types, see Details}
+ \item{lwd}{box border and shading line width, see Details}
+ \item{margin}{amount to adjust box border in or out. See Details}
+}
+\details{
+ Draws text in the box by pasting the textlist vector together, splitting it
+ into words, and then adding words to the current line until the line is wide
+ enough before moving on to the next line.
+
+ \samp{margin} may be a vector of 1, 2, or 4 values, corresponding to 
+ adjustment of all borders (1 value), top/bottom and left/right borders
+ (2 values), or bottom/left/top/right borders (4 values).  A positive value
+ moves text inwards from specified (x,y) position with border remaining at (x,y),
+ and a negative value moves the border outwards from (x,y) with the text
+ remaining at (x,y).
+
+ The \samp{density} and \samp{angle} arguments have the same behavior as in the
+ \samp{rect} function. The \samp{adj, font} and {vfont} arguments have the same
+ behavior as in the \samp{text} function. The \samp{lty} and \samp{lwd} 
+ arguments have the same behavior as in the \samp{lines} function.
+}
+\value{
+ y-position of bottom line of box, or y-position of next line if there is no box.
+}
+\author{Ben Bolker. Improvements by Ted Toal.}
+\examples{
+ plot.new()
+ textbox(c(0,0.2), 1, c("many words","more words","why not?",
+  "keep going",rep("and going",10)))
+ textbox(c(0.3,0.5), 1, c("keep going",rep("and going",10)), cex=0.45,
+  col="blue", border="red", fill="#00FFEE80", density=25, angle=60)
+ textbox(c(0.6,0.8), 1, c("keep going",rep("and going",10)), justify='c', cex=0.6,
+  leading=1, font=4, border="gold", lty=2, lwd=4, margin=0.025)
+ textbox(c(0.6,0.8), 0.5, c("keep going",rep("and going",10)), justify='r', cex=0.7,
+  col="purple", font=3, border="green", margin=-0.025)
+ lines(c(0,1), c(1,1), col="red", lty=2)
+ lines(c(0,1), c(0.5,0.5), col="red", lty=2)
+}
+\keyword{aplot}
diff --git a/man/thigmophobe.Rd b/man/thigmophobe.Rd
new file mode 100755
index 0000000..a009d77
--- /dev/null
+++ b/man/thigmophobe.Rd
@@ -0,0 +1,34 @@
+\name{thigmophobe}
+\title{Find the direction away from the closest point}
+\description{Find the direction away from the closest point}
+\usage{
+ thigmophobe(x,y)
+}
+\alias{thigmophobe}
+\arguments{
+ \item{x,y}{Numeric data vectors. Typically the x/y coordinates of
+  plotted points. If arrays are passed, they will be silently coerced to
+  numeric vectors.}
+}
+\details{
+ \samp{thigmophobe} returns the direction (as 1|2|3|4 - see pos= in 
+ \samp{text}) away from the nearest point to each of the points 
+ described by \samp{x} and \samp{y}.
+}
+\note{
+ \samp{thigmophobe} is typically used to get the offset to automatically
+  place labels on a scatterplot or similar using \samp{thigmophobe.labels}
+ to avoid overlapping labels. The name means "one who fears being touched".
+}
+\value{
+ A vector of directions away from the point nearest to each point.
+}
+\keyword{misc}
+\author{Jim Lemon - thanks to Gustaf Rydevik for the "names" bug fix
+ and to Steve Ellison for the suggestion about arrays.}
+\seealso{\link{thigmophobe.labels}}
+\examples{
+ x<-rnorm(10)
+ y<-rnorm(10)
+ thigmophobe(x,y)
+}
diff --git a/man/thigmophobe.labels.Rd b/man/thigmophobe.labels.Rd
new file mode 100755
index 0000000..8607084
--- /dev/null
+++ b/man/thigmophobe.labels.Rd
@@ -0,0 +1,66 @@
+\name{thigmophobe.labels}
+\title{Place labels away from the nearest point}
+\usage{
+ thigmophobe.labels(x,y,labels=NULL,text.pos=NULL,...)
+}
+\alias{thigmophobe.labels}
+\arguments{
+ \item{x,y}{Numeric data vectors or a list with two components. 
+  Typically the x/y coordinates of plotted points.}
+ \item{labels}{A vector of strings that will be placed adjacent to
+  each point. Defaults to the indices of the coordinates.}
+ \item{text.pos}{An optional vector of text positions (see 
+ \link{text}).}
+ \item{...}{additional arguments are passed to \samp{text}}.
+}
+\description{
+ \samp{thigmophobe.labels} places labels adjacent to each point, 
+  offsetting each label in the direction returned by 
+  \samp{thigmophobe}.
+}
+\details{
+ Typically used to automatically place labels on a scatterplot or 
+ similar to avoid overlapping labels. \samp{thigmophobe.labels}
+ will sometimes place a label off the plot or fail to separate
+ labels in clusters of points. The user can manually adjust the
+ errant labels by running \samp{thigmophobe} first and saving
+ the returned vector. Then modify the position values to place
+ the labels properly and pass the edited vector to
+ \samp{thigmophobe.labels} as the \samp{text.pos} argument. This
+ takes precedence over the positions calculated by \samp{thigmophobe}.
+ 
+ \samp{thigmophobe} will fail with only two labels, as it can't figure out
+ the nearest neighbors. If you really want to use this with two labels, just
+ eyeball the plot and work out in which direction the labels will go. Then
+ pass the directions to \samp{thigmophobe.labels} as the \samp{text.pos}
+ argument. When all else fails, look to samp{placeLabels}.
+
+ Both \samp{pointLabel} in the \pkg{maptools} package and \samp{spread.labs}
+ in the \pkg{TeachingDemos} package use more sophisticated algorithms to
+ place the labels and are worth a try if \samp{thigmophobe} just won't get it
+ right.
+}
+\value{
+ A vector of directions away from the point nearest to each point.
+}
+\keyword{misc}
+\author{Jim Lemon (thanks to Stephen Milborrow for finding the single point bug
+ and Erik Aronesty for finding the two point problem.)}
+\seealso{\link{thigmophobe}, \link{text}}
+\examples{
+ x<-rnorm(20)
+ y<-rnorm(20)
+ xlim<-range(x)
+ xspace<-(xlim[2]-xlim[1])/20
+ xlim<-c(xlim[1]-xspace,xlim[2]+xspace)
+ ylim<-range(y)
+ yspace<-(ylim[2]-ylim[1])/20
+ ylim<-c(ylim[1]-yspace,ylim[2]+yspace)
+ plotlabels<-
+  c("one","two","three","four","five","six","seven","eight","nine","ten",
+  "eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen",
+  "eighteen","nineteen","twenty")
+ plot(x=x,y=y,xlim=xlim,ylim=ylim,main="Test thigmophobe.labels")
+ # skip the almost invisible yellow label, make them bold
+ thigmophobe.labels(x,y,plotlabels,col=c(2:6,8:12),font=2)
+}
diff --git a/man/triax.abline.Rd b/man/triax.abline.Rd
new file mode 100755
index 0000000..c9a9cdc
--- /dev/null
+++ b/man/triax.abline.Rd
@@ -0,0 +1,42 @@
+\name{triax.abline}
+\alias{triax.abline}
+\title{Lines for triangle plot}
+\description{
+ Display lines on a triangle plot.
+}
+\usage{
+ triax.abline(b=NULL,r=NULL,l=NULL,col=par("col"),lty=par("lty"),
+  cc.axes=FALSE)
+}
+\arguments{
+ \item{b}{Lines relating to the bottom axis.}
+ \item{r}{Lines relating to the right axis.}
+ \item{l}{Lines relating to the left axis.}
+ \item{col}{Color(s) of the lines.}
+ \item{lty}{Type(s) of the lines.}
+ \item{cc.axes}{Clockwise/counterclockwise axes and ticks.}
+}
+\details{
+ \samp{triax.abline} displays one or more lines on a triangle plot. Lines
+  are oriented in the conventional way, horizontal for the left axis, 
+  slanting up to the right for the right axis and up to the left for the 
+  bottom axis. If \samp{cc.axes} is TRUE, the orientation is up-left for
+  the left axis, horizontal for the right axis and up-right for the bottom
+  axis.
+  
+  Remember to call \samp{triax.plot} with \samp{no.add=FALSE} and restore
+  the graphics parameters as in the example or the lines will not be
+  placed properly.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{triax.plot}}
+\examples{
+ triax.return<-triax.plot(data.frame(bottom=0.4,right=0.3,left=0.3),
+  main="Triax ablines",no.add=FALSE)
+ triax.abline(l=0.3,col="red")
+ triax.abline(r=0.3,col="green")
+ triax.abline(b=0.4,col="blue")
+ par(triax.return$oldpar)
+}
+\keyword{misc}
diff --git a/man/triax.fill.Rd b/man/triax.fill.Rd
new file mode 100755
index 0000000..cbe2232
--- /dev/null
+++ b/man/triax.fill.Rd
@@ -0,0 +1,40 @@
+\name{triax.fill}
+\alias{triax.fill}
+\title{Triangle plot fill}
+\description{
+ Fill a triangle plot with smaller triangles.
+}
+\usage{
+ triax.fill(col)
+}
+\arguments{
+ \item{col}{List of colors (see Details).}
+}
+\details{
+ In order for \samp{triax.fill} to fill an existing plot that has
+ been created by a call to \samp{triax.plot}, the user must supply
+ a list of fill colors. The first element of the list must begin with
+ at least one value that can be interpreted as a color. The second
+ element must begin with at least three such values, and so on, adding
+ two values for each element of the list. Each list element will be
+ displayed as a row of colored triangles starting at the top of the
+ plot. The number of elements in the list determines the number of
+ rows that will be displayed.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{triax.plot},\link{color.scale}}
+\examples{
+ # the data will be something like response at different proportions
+ fillval<-list(0,c(0,0.1,0),c(0,0.1,0.2,0.1,0),
+  c(0,0.1,0.2,0.3,0.2,0.1,0),c(0,0.1,0.2,0.3,0.4,0.3,0.2,0.1,0),
+  c(0,0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1,0),
+  c(0,0,0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1,0,0),
+  c(0,0,0,0.1,0.1,0.2,0.3,0.4,0.3,0.2,0.1,0.1,0,0,0))
+ # use some method of converting values to colors
+ fillcol<-sapply(fillval,function(x) {x*10+1} )
+ oldpar<-triax.plot(main="Test of triax.fill function")
+ triax.fill(fillcol)
+ par(oldpar)
+}
+\keyword{misc}
diff --git a/man/triax.frame.Rd b/man/triax.frame.Rd
new file mode 100755
index 0000000..76cfd45
--- /dev/null
+++ b/man/triax.frame.Rd
@@ -0,0 +1,42 @@
+\name{triax.frame}
+\alias{triax.frame}
+\title{Triangle plot frame}
+\description{
+ Display a three axis frame with optional grid.
+}
+\usage{
+ triax.frame(at=seq(0.1,0.9,by=0.1),axis.labels=NULL,
+ tick.labels=NULL,col.axis="black",cex.axis=1,cex.ticks=1,
+ align.labels=TRUE,show.grid=FALSE,col.grid="gray",lty.grid=par("lty"),
+ cc.axes=FALSE)
+}
+\arguments{
+ \item{at}{The tick positions on the three axes.}
+ \item{axis.labels}{Labels for the three axes in the order bottom, right
+  left. Defaults to the column names.}
+ \item{tick.labels}{The tick labels for the axes.
+  Defaults to argument \samp{at} (proportions).}
+ \item{col.axis}{Color of the triangular axes, ticks and labels.}
+ \item{cex.axis}{Character expansion for axis labels.}
+ \item{cex.ticks}{Character expansion for the tick labels.}
+ \item{align.labels}{Logical - whether to align axis and tick labels with
+  the axes.}
+ \item{show.grid}{Whether to display grid lines at the ticks.}
+ \item{col.grid}{Color of the grid lines. Defaults to gray.}
+ \item{lty.grid}{Type of line for the grid.}
+ \item{cc.axes}{Whether to align the axes clockwise or counterclockwise.}
+}
+\details{
+ \samp{triax.frame} displays a triangular plot area on which proportions
+  or percentages may be displayed. An optional grid may also be displayed.
+  If \samp{cc.axes} is TRUE, both the axes and axis ticks will be in
+  reverse order.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{triax.points},\link{triax.abline},\link{triax.fill}}
+\examples{
+ triax.plot(main="DEFAULT")
+ triax.plot(main="Clockwise axes",cc.axes=TRUE)
+}
+\keyword{misc}
diff --git a/man/triax.plot.Rd b/man/triax.plot.Rd
new file mode 100755
index 0000000..87a20d6
--- /dev/null
+++ b/man/triax.plot.Rd
@@ -0,0 +1,88 @@
+\name{triax.plot}
+\alias{triax.plot}
+\title{Triangle plot}
+\description{
+ Display a triangle plot with optional grid.
+}
+\usage{
+ triax.plot(x=NULL,main="",at=seq(0.1,0.9,by=0.1),
+ axis.labels=NULL,tick.labels=NULL,col.axis="black",cex.axis=1,cex.ticks=1,
+ align.labels=TRUE,show.grid=FALSE,col.grid="gray",lty.grid=par("lty"),
+ cc.axes=FALSE,show.legend=FALSE,label.points=FALSE,point.labels=NULL,
+ col.symbols="black",pch=par("pch"),mar=c(5,2,4,2),no.add=TRUE,...)
+}
+\arguments{
+ \item{x}{Matrix where each row is three proportions or percentages
+  that must sum to 1 or 100 respectively.}
+ \item{main}{The title of the triangle plot. Defaults to nothing.}
+ \item{at}{The tick positions on the three axes.}
+ \item{axis.labels}{Labels for the three axes in the order left, right,
+  bottom. Defaults to the column names.}
+ \item{tick.labels}{The tick labels for the three axes as a list with
+  three components l, r and b (left, right and bottom).
+  Defaults to argument \samp{at} (proportions).}
+ \item{col.axis}{Color of the triangular axes, ticks and labels.}
+ \item{cex.axis}{Character expansion for axis labels.}
+ \item{cex.ticks}{Character expansion for the tick labels.}
+ \item{align.labels}{Logical - whether to align axis and tick labels with
+  the axes.}
+ \item{show.grid}{Whether to display grid lines at the ticks.}
+ \item{col.grid}{Color of the grid lines. Defaults to gray.}
+ \item{lty.grid}{Type of line for the grid.}
+ \item{cc.axes}{Whether axes and axis ticks should be clockwise or
+  counterclockwise.}
+ \item{show.legend}{Logical - whether to display a legend.}
+ \item{label.points}{Logical - whether to call \samp{thigmophobe.labels} to
+  label the points.}
+ \item{point.labels}{Optional labels for the points and/or legend.}
+ \item{col.symbols}{Color of the symbols representing each value.}
+ \item{pch}{Symbols to use in plotting values.}
+ \item{mar}{Margins for the triangle plot.}
+ \item{no.add}{Whether to restore the previous plotting parameters
+  (\samp{TRUE}) or leave them, allowing more points to be added.}
+ \item{...}{Additional arguments passed to \samp{points}.}
+}
+\details{
+ \samp{triax.plot} displays a triangular plot area on which proportions
+  or percentages are displayed. A grid or legend may also be displayed.
+}
+\note{
+ A three axis plot can only properly display one or more
+ sets of three proportions that each sum to 1 (or percentages that sum
+ to 100). Other values may be scaled to proportions (or percentages), 
+ but unless each set of three sums to 1 (or 100), they will not plot
+ properly and \samp{triax.points} will complain appropriately. Note also
+ that \samp{triax.plot} will only display properly in a square plot,
+ which is forced by \samp{par(pty="s")}.
+ 
+ In case the user does want to plot values with different sums, the
+ axis tick labels can be set to different ranges to accomodate this.
+ \samp{triax.points} will still complain, but it will plot the values.
+ 
+ If planning to add points with \samp{triax.points} call \samp{triax.plot}
+ with \samp{no.add=FALSE} and restore plotting parameters after the
+ points are added.
+}
+\value{
+ A list containing \samp{xypos} (the \samp{x,y} positions plotted)
+ and \samp{oldpar} (the plotting parameters at the time \samp{triax.plot}
+ was called).
+}
+\author{
+ Jim Lemon - thanks to Ben Daughtry for the info on counterclockwise axes.
+}
+\seealso{
+ \link{triax.points}, \link{triax.abline}, \link{thigmophobe.labels}
+}
+\examples{
+ data(soils)
+ triax.plot(soils[1:10,],main="DEFAULT")
+ triax.plot(soils[1:10,],main="PERCENTAGES (Counterclockwise axes)",
+  tick.labels=list(l=seq(10,90,by=10),r=seq(10,90,by=10),b=seq(10,90,by=10)),
+  pch=3,cc.axes=TRUE)
+ triax.return<-triax.plot(soils[1:6,],main="GRID AND LEGEND",
+  show.grid=TRUE,show.legend=TRUE,col.symbols=1:6,pch=4)
+ # triax.plot changes a few parameters
+ par(triax.return$oldpar)
+}
+\keyword{misc}
diff --git a/man/triax.points.Rd b/man/triax.points.Rd
new file mode 100755
index 0000000..51b9f26
--- /dev/null
+++ b/man/triax.points.Rd
@@ -0,0 +1,47 @@
+\name{triax.points}
+\alias{triax.points}
+\title{Triangle plot points}
+\description{
+ Display points on a triangle plot.
+}
+\usage{
+ triax.points(x,show.legend=FALSE,label.points=FALSE,point.labels=NULL,
+ col.symbols=par("fg"),pch=par("pch"),bg.symbols=par("bg"),cc.axes=FALSE,...)
+}
+\arguments{
+ \item{x}{Matrix or data frame where each row is three proportions or 
+  percentages that must sum to 1 or 100 respectively.}
+ \item{show.legend}{Logical - whether to display a legend.}
+ \item{label.points}{Logical - whether to call \samp{thigmophobe.labels}
+  to label the points.}
+ \item{point.labels}{Optional labels for the points and/or legend.}
+ \item{col.symbols}{Color of the symbols representing each value.}
+ \item{pch}{Symbols to use in plotting values.}
+ \item{bg.symbols}{Background color for plotting symbols.}
+ \item{cc.axes}{Clockwise or counterclockwise axes and ticks.}
+ \item{...}{Additional arguments passed to \samp{points}.}
+}
+\details{
+ In order for \samp{triax.points} to add points to an existing plot,
+ the argument \samp{no.add} in the initial call to \samp{triax.plot} 
+ must be set to \samp{FALSE}. Failing to do this will result in the
+ points being plotted in the wrong places. It is then up to the user
+ to call \samp{par} as in the example below to restore plotting
+ parameters altered during the triangle plot.
+ 
+ \samp{triax.points} displays each triplet of proportions or percentages
+  as a symbol on the triangle plot. Unless each triplet sums to 1 
+  (or 100), they will not plot properly and \samp{triax.points} will 
+  complain appropriately.
+}
+\value{A list of the \samp{x,y} positions plotted.}
+\author{Jim Lemon}
+\seealso{\link{triax.plot},\link{thigmophobe.labels}}
+\examples{
+ data(soils)
+ triax.return<-triax.plot(soils[1:10,],
+  main="Adding points to a triangle plot",no.add=FALSE)
+ triax.points(soils[11:20,],col.symbols="green",pch=3)
+ par(triax.return$oldpar)
+}
+\keyword{misc}
diff --git a/man/tsxpos.Rd b/man/tsxpos.Rd
new file mode 100644
index 0000000..f4a38a2
--- /dev/null
+++ b/man/tsxpos.Rd
@@ -0,0 +1,42 @@
+\name{tsxpos}
+\title{Calculate equispaced x positions.}
+\description{Calculate equispaced x positions of values that have been
+ plotted with the plot command.}
+\usage{
+ tsxpos(x,xlim,nint)
+}
+\alias{tsxpos}
+\arguments{
+ \item{x}{A vector of numeric values or a time series object created with
+  the ts function.}
+ \item{xlim}{Explicit x limits for the x positions.}
+ \item{nint}{The number of \emph{intervals} between x positions.}
+}
+\details{
+ \samp{tsxpos} calculates equispaced x positions for a vector of values or
+ a time series created with the \samp{ts} command from the \pkg{stats} package.
+ It assumes that the default x limits have been used in the existing plot. It
+ adds the appropriate padding if \samp{par("xaxs")} is "r". It is mainly useful
+ when x axis labels or some other markers are to be added to a time series plot.
+
+ A plot device must be open. If the user wishes to specify explicit x limits
+ or the number of intervals (not values), these will override the calculations
+ from the x values.
+}
+\value{The calculated x positions in user units.}
+\author{Jim Lemon (thanks to Prof J.C. Nash for the idea)}
+\examples{
+ # create a vector of numbers
+ y<-rnorm(28)
+ par(mfrow=c(2,1),mar=c(6,4,4,2))
+ plot(y,main="Plot of the values")
+ # convert it into a time series object
+ yt<-ts(y,start=2011,frequency=12)
+ # don't use the default axis
+ plot(yt,main="Plot of the time series",xaxt="n",xlab="Month")
+ labelpos<-tsxpos(yt)
+ # display an axis showing the months only
+ staxlab(1,labelpos,rep(month.abb,length.out=28))
+ par(mfrow=c(1,1),mar=c(5,4,4,2))
+}
+\keyword{misc}
diff --git a/man/twoord.plot.Rd b/man/twoord.plot.Rd
new file mode 100755
index 0000000..1555634
--- /dev/null
+++ b/man/twoord.plot.Rd
@@ -0,0 +1,140 @@
+\name{twoord.plot}
+\alias{twoord.plot}
+\title{ Plot with two ordinates }
+\description{
+ Two sets of values are displayed on the same plot with different ordinate
+ scales on the left and right.
+}
+\usage{
+ twoord.plot(lx,ly,rx,ry,data=NULL,main="",xlim=NULL,lylim=NULL,rylim=NULL,
+ mar=c(5,4,4,4),lcol=1,rcol=2,xlab="",lytickpos=NA,ylab="",ylab.at=NA,
+ rytickpos=NA,rylab="",rylab.at=NA,lpch=1,rpch=2,
+ type="b",xtickpos=NULL,xticklab=NULL,halfwidth=0.4,axislab.cex=1,
+ do.first=NULL,...)
+}
+\arguments{
+ \item{lx,ly,rx,ry}{y and optional x values for the plot}
+ \item{data}{an optional data frame from which to obtain the above values}
+ \item{main}{Title for the plot}
+ \item{xlim}{optional x limits as in \samp{plot}}
+ \item{lylim,rylim}{optional y limits for the left and right axes
+  respectively}
+ \item{mar}{optional margin adjustment, defaults to \samp{c(5,4,4,4)}}
+ \item{lcol,rcol}{colors to distinguish the two sets of values}
+ \item{xlab}{X axis label as in \samp{plot}}
+ \item{lytickpos}{Optional positions for the left axis tick labels.}
+ \item{ylab}{Left Y axis label as in \samp{plot}}
+ \item{ylab.at}{Optional position for the left Y axis label}
+ \item{rytickpos}{Optional positions for the right axis tick labels.}
+ \item{rylab}{Right Y axis label}
+ \item{rylab.at}{Optional position for the right Y axis label}
+ \item{lpch,rpch}{plot symbols to distinguish the two sets of values}
+ \item{type}{as in \samp{plot}}
+ \item{xtickpos}{Optional positions for x-axis tick labels.}
+ \item{xticklab}{Optional labels for x-axis. Useful for things like dates.}
+ \item{halfwidth}{Half the width of the bars in user units. The bars are
+  centered on successive integers if no \samp{x} values are supplied.}
+ \item{axislab.cex}{Character expansion for the axis labels and tick labels.}
+ \item{do.first}{Optional command(s) that will be executed immediately after
+  the blank plot is displayed.}
+ \item{...}{additional arguments passed to \samp{plot} and \samp{points}.}
+}
+\value{nil}
+\details{
+ \samp{twoord.plot} automates the process of displaying two sets of
+ values that have different ranges on the same plot. It is principally
+ useful in illustrating some relationship between the values across the
+ observations. It is assumed that the \samp{lx} and \samp{rx} values
+ are at least adjacent, and probably overlapping.
+ 
+ It is best to pass all the arguments \samp{lx, ly, rx, ry}, but the
+ function will attempt to substitute sensible x values if one or two
+ are missing.
+
+ If at least one of the \samp{type} arguments is "bar", bars will be plotted
+ instead of points or lines. It is best to plot the bars first (i.e. relative
+ to the left axis) if the other type is points or lines, as the bars will
+ usually obscure at least some of the points or lines. Using NA for the color
+ of the bars will partially correct this. If both types are to be bars,
+ remember to pass somewhat different x values or the bars will be overplotted.
+
+ Note that more values can be added to the plot using \samp{points} or
+ \samp{lines}, but remember that these will be plotted relative to the left
+ ordinate.
+
+ The \samp{do.first} argument is useful for adding a background color or grid
+ to the plot as shown in the first two examples.
+}
+\note{
+ There are many objections to the use of plots with two different 
+ ordinate scales, and some of them are even sensible and supported by 
+ controlled observation. Many of the objections rest on assertions that the 
+ spatial arrangement of the values plotted will override all other 
+ evidence. Here are two:
+ 
+ The viewer will assume that the vertical position of the data points 
+ indicates a quantitative relationship.
+ 
+ To some extent. It is probably not a good idea to have the spatial 
+ relationship of the points opposed to their numerical relationship. That 
+ is to say, if one set of values is in the range of 0-10 and the other 
+ 20-100, it is best to arrange the plot so that the latter values are 
+ not plotted below the former. See the second example, which illustrates 
+ a method for separating the two series and offsetting the axes.
+ 
+ The viewer will assume that an intersection of lines indicates an 
+ intersection of values.
+ 
+ If the visual elements representing values can be arranged to avoid 
+ intersections, so much the better. Many people have no trouble 
+ distinguishing which visual elements are linked to which axis as long as 
+ they are both coded similarly, usually with colors and/or symbols. In the 
+ special case where there is an underlying relationship between the two 
+ such as the probability of that value occurring under some conditions, it 
+ may help to mark the point(s) where this occurs.
+ 
+ It may be useful to consider \samp{gap.plot} or separate plots as an
+ alternative.
+}
+\author{Jim Lemon (thanks to Christophe Dutang for the idea of using bars
+ and lines in the same plot, Clair Crossupton for pointing out that
+ dates on the x-axis weren't very good, Jacob Kasper for the axis
+ character expansion and Ye Lin for finally motivating me to add the
+ do.first argument.)}
+\seealso{\link{plot}}
+\examples{
+ going_up<-seq(3,7,by=0.5)+rnorm(9)
+ going_down<-rev(60:74)+rnorm(15)
+ twoord.plot(2:10,going_up,1:15,going_down,xlab="Sequence",
+  ylab="Ascending values",rylab="Descending values",lcol=4,
+  main="Plot with two ordinates - points and lines",
+  do.first="plot_bg();grid(col=\"white\",lty=1)")
+ # now separate the lines
+ twoord.plot(2:10,going_up,1:15,going_down,xlab="Sequence",
+  lylim=range(going_up)+c(-1,10),rylim=range(going_down)+c(-10,2),
+  ylab="Ascending values",ylab.at=5,rylab="Descending values",
+  rylab.at=65,lcol=4,main="Plot with two ordinates - separated lines",
+  lytickpos=3:7,rytickpos=seq(55,75,by=5),
+  do.first="plot_bg();grid(col=\"white\",lty=1)")
+ twoord.plot(2:10,going_up,1:15,going_down,xlab="Sequence",
+  lylim=range(going_up)+c(-1,10),rylim=range(going_down)+c(-10,2),
+  type=c("bar","l"),ylab="Ascending values",ylab.at=5,
+  rylab="Descending values",rylab.at=65,
+  main="Bars on left axis, lines on right axis",
+  lytickpos=3:7,rytickpos=seq(55,75,by=5),
+  lcol=3,rcol=4,do.first="plot_bg()")
+ twoord.plot(2:10,going_up,1:15,going_down,xlab="Sequence",
+  lylim=c(-3,8),rylim=c(50,100),type=c("l","bar"),
+  ylab="Ascending values",rylab="Descending values",
+  lytickpos=3:7,rytickpos=seq(55,75,by=5),ylab.at=5,rylab.at=65,
+  main="Lines on left axis, bars on right axis",
+  lcol=3,rcol=4,do.first="plot_bg(\"yellow\")")
+ # histogram with density curve superimposed
+ xhist<-hist(rnorm(100),plot=FALSE)
+ xdens<-dnorm(seq(-3,3,by=0.05))
+ twoord.plot(xhist$mids,xhist$counts,seq(-3,3,by=0.05),
+ xdens,type=c("bar","l"),lcol=4,rcol=2,ylab="Counts",
+ rylab="Density",main="Histogram and density curve",
+ halfwidth=0.2,lylim=c(0,max(xhist$counts)+1),rylim=c(0,0.45),lwd=2)
+}
+\keyword{misc}
diff --git a/man/twoord.stackplot.Rd b/man/twoord.stackplot.Rd
new file mode 100755
index 0000000..8798cce
--- /dev/null
+++ b/man/twoord.stackplot.Rd
@@ -0,0 +1,88 @@
+\name{twoord.stackplot}
+\alias{twoord.stackplot}
+\title{Multiple (stack) plot with two ordinates}
+\description{
+	Two set of data are plotted on two different ordinate scales.
+}
+\usage{
+twoord.stackplot(lx, rx, ldata, rdata, lcol, rcol, ltype, rtype, 
+	border, rylab, lylab, xlab, ..., incrylim=NULL,
+	halfwidth=0.4, leftfront=FALSE, mar = c(5, 4, 4, 4))
+}
+\arguments{
+  \item{lx,rx}{x-values for left/right data.}
+  \item{ldata,rdata}{data on the left/right y-axes.}
+  \item{lcol, rcol}{colors to be used for left/right data.}
+  \item{ltype, rtype}{line types to be used for left/right data, see details.}
+  \item{border}{color for the border of barplot}
+  \item{rylab,lylab}{labels for the left/right y-axes.}
+  \item{xlab}{labels for the x-axis.}
+  \item{...}{further arguments to be passed to \samp{plot}.}
+  \item{incrylim}{a number to increase the limits of y-axes.}
+  \item{halfwidth}{half the width of the bars in user units. 
+	The bars are centered on successive integers if no x values are supplied}
+  \item{leftfront}{if \samp{TRUE}, plot the left data on the front layer.}
+  \item{mar}{optional margin adjustment, defaults to c(5,4,4,4).}
+}
+\details{
+\samp{twoord.stackplot} works in the same way as \samp{twoord.plot}
+ on which it is heavily inspired. The functions let the user plot
+ multiple curve/point or bar plots on the same graph with two different axes.
+ The line type can be one of the following \samp{"l"} for lines,
+ \samp{"p"} for points, \samp{"b"} for both points and line, 
+ \samp{"o"} for overplotted, \samp{"bar"} for barplot.
+}
+\value{ nil }
+\seealso{\link{twoord.plot}}
+\author{ Christophe Dutang }
+\examples{
+# plot data
+#
+
+time <- 0:25
+
+A <- 1+1/2*sin(time/2)
+B <- A + rnorm(length(A), sd=1/10)
+B <- B + rnorm(length(A), sd=1/10)
+
+sizeA <- floor(450*(1 + 1/4*sin(time/2+2))*(1+.1))
+sizeB <- 1000-sizeA
+
+C <- (A*sizeA + B*sizeB)/(sizeA+sizeB)
+
+
+#typical usage 
+#
+
+twoord.stackplot(lx=time, rx=time, ldata=cbind(sizeA, sizeB), 
+	rdata=cbind(A, B, C),  lcol=c("grey80", "white"), 
+	rcol=c("blue", "red","black"), ltype="bar", rtype=c("l","p","o"), 
+	border="grey80", lylab="Size", rylab="A,B,C", xlab="Time", 
+	main="a plot", incrylim=2/100)
+
+#add a legend
+#
+
+par(xpd=TRUE) #extend the area of plotting
+par(new=TRUE) #to add new graph "layers"
+plot(0:1, 0:1, type="n", xlab="",ylab="", axes=FALSE) #redo the x/y limits
+
+#first legend
+legend(-0.18, 1.2, leg=c("Size A", "Size B"), fill=c("grey80", "white")) 
+#second legend
+legend(.97, -0.08, leg=c("A", "B", "C"), col=c("blue", "red","black"), 
+	pch=c(NA, 19, 19), lty=c(1,NA,1)) 
+
+par(xpd=FALSE, new=FALSE) #default setting
+
+
+
+#reverse the order of plotting
+twoord.stackplot(lx=time, rx=time, ldata=cbind(sizeA, sizeB), 
+	rdata=cbind(A, B, C),  lcol=c("grey80", "white"), 
+	rcol=c("blue", "red","black"), ltype="bar", rtype=c("l","p","o"), 
+	border="grey80", lylab="Size", rylab="A,B,C", xlab="Time", 
+	main="a plot", incrylim=2/100, leftfront=TRUE)
+
+}
+\keyword{misc}
diff --git a/man/valid.n.Rd b/man/valid.n.Rd
new file mode 100755
index 0000000..b57da22
--- /dev/null
+++ b/man/valid.n.Rd
@@ -0,0 +1,21 @@
+\name{valid.n}
+\alias{valid.n}
+\title{
+ Find the number of valid (not NA) values
+}
+\description{
+ Finds the number of valid (not NA) or total values in an object.
+}
+\usage{
+ valid.n(x,na.rm=TRUE)
+}
+\arguments{
+ \item{x}{An object.}
+ \item{na.rm}{Whether to count all values (FALSE) or only those not NA.}
+}
+\details{
+ \samp{valid.n} finds the number of valid values of the object if \samp{na.rm=TRUE}.
+}
+\value{The number of valid values or the length of the object.}
+\author{Jim Lemon}
+\keyword{misc}
diff --git a/man/vectorField.Rd b/man/vectorField.Rd
new file mode 100755
index 0000000..d8585b4
--- /dev/null
+++ b/man/vectorField.Rd
@@ -0,0 +1,64 @@
+\name{vectorField}
+\alias{vectorField}
+\title{Display magnitude/direction vectors}
+\description{Display magnitude/direction vectors as arrows on an existing plot.}
+\usage{
+
+vectorField(u,v,xpos=NA,ypos=NA,scale=1,headspan=0.1,
+ vecspec=c("lonlat","rad","deg"),col=par("fg"))
+}
+\arguments{
+ \item{u,v}{x (longitude) and y (latitude) offsets OR
+  orientation and magnitude in either radians or degrees. See details.}
+ \item{xpos,ypos}{The centers of the vectors in user units.}
+ \item{scale}{The proportion of each cell that the maximal vector will fill.
+  See details.}
+ \item{headspan}{The extent of the heads of the arrows as a proportion of
+  cell size.}
+ \item{vecspec}{How the vectors are described. See details}
+ \item{col}{Color(s) for the arrows.}
+}
+\value{ nil }
+\details{
+ \samp{vectorField} displays arrows on an existing plot. Each arrow is specified
+ by a position on the plot \samp{xpos,ypos} and either x/y offsets or
+ orientation and magnitude. The default is x/y offsets, and the user must
+ specify whether radians or degrees are used if the orientation/magnitude option
+ is used.
+ 
+ If the first four arguments are matrices, there must be no missing values. If
+ these arguments are vectors, the calculation of the scaling of the magnitudes
+ and length of the arrowheads may be slightly different.
+}
+\author{Jim Lemon (original code by Robin Hankin and Brian Ripley)}
+\seealso{\link{arrows}}
+\examples{
+ \dontrun{
+  # this requires the maps package, and just wouldn't pass check
+  require(maps)
+  map("world",xlim=c(110,155),ylim=c(-40,-10))
+  par(xpd=TRUE)
+  text(132,-5,"Approximate magnetic deviation - Australia",cex=1.5)
+  par(xpd=FALSE)
+  long<-rep(seq(117.5,152.5,by=5),6)
+  lat<-rep(c(-12.5,-17.5,-22.5,-27.5,-32.5,-37.5),each=8)
+  # just show the direction, don't have a magnitude difference
+  mag<-rep(1,48)
+  devdeg<-c(110,98,85,65,65,65,65,65,
+   115,100,90,80,72,66,63,55,
+   130,100,90,82,72,67,62,54,
+   122,111,95,86,70,67,56,48,
+   118,116,110,87,74,68,62,45,
+   128,115,107,90,78,66,53,45)
+  vectorField(devdeg,mag,long,lat,scale=0.7,vecspec="deg")
+ }
+ # do a magnitude/direction plot with radians
+ plot(1:10,type="n",main="Random vectors")
+ mag<-runif(100)+1
+ dir<-runif(100)*2*pi
+ xpos<-rep(1:10,10)
+ ypos<-rep(1:10,each=10)
+ vectorcol<-sample(colors(),100)
+ vectorField(dir,mag,xpos,ypos,scale=0.8,vecspec="rad",col=vectorcol)
+}
+\keyword{misc}
diff --git a/man/weighted.hist.Rd b/man/weighted.hist.Rd
new file mode 100755
index 0000000..08a0c71
--- /dev/null
+++ b/man/weighted.hist.Rd
@@ -0,0 +1,64 @@
+\name{weighted.hist}
+\alias{weighted.hist}
+\title{
+ Display a weighted histogram
+}
+\description{
+ Calculate the counts of the weighted values in specified bins and 
+ optionally display either a frequency or density histogram.
+}
+\usage{
+ weighted.hist(x,w,breaks="Sturges",col=NULL,plot=TRUE,
+ freq=TRUE,ylim,ylab=NULL,xaxis=TRUE,...)
+}
+\arguments{
+ \item{x}{A vector of numeric values}
+ \item{w}{A vector of weights at least as long as x.}
+ \item{breaks}{The endpoints of the ranges into which to count the weighted
+  values.}
+ \item{col}{An optional vector of colors for the bars of the histogram.}
+ \item{plot}{Whether to plot a histogram.}
+ \item{freq}{Whether to plot counts or densities.}
+ \item{ylim}{The limits of the plot ordinate.}
+ \item{ylab}{Label for the ordinate.}
+ \item{xaxis}{Whether to display the default x axis.}
+ \item{...}{Additional arguments passed to \link{barplot}.}
+}
+\details{
+ \samp{weighted.hist} calculates the weighted counts of values falling 
+ into the ranges specified by \samp{breaks}. Instead of counting each 
+ value as 1, it counts the corresponding value in \samp{w} (the weight).
+ 
+ \samp{breaks} may be specified by a monotonically increasing vector 
+ of numbers that are interpreted as the endpoints of the ranges, a 
+ single number representing the number of ranges desired or the name 
+ of the function to calculate the ranges (see \link{hist}).
+ If a vector of numbers is passed that does not include all values in 
+ \samp{x}, the user is warned. If the ranges are not equal, a warning 
+ will be displayed if \samp{freq} is TRUE or the heights of the bars 
+ will be adjusted to display areas approximately equal to the counts 
+ if \samp{freq} is FALSE.
+}
+\value{A list containing:
+
+breaks - The endpoints of the intervals
+
+counts - The weighted counts
+
+density - The weighted counts divided by their sum.
+
+mids - The midpoints of the intervals and the bars displayed.
+
+xname - the name of \samp{x}.
+
+equidist - Whether the intervals differ by less than the total range/1000.
+}
+\author{Jim Lemon and Hadley Wickham - thanks to Ben Graf for asking for a
+ custom x axis option}
+\seealso{\link{hist}}
+\examples{
+ testx<-sample(1:10,300,TRUE)
+ testw<-seq(1,4,by=0.01)
+ weighted.hist(testx,testw,breaks=1:10,main="Test weighted histogram")
+}
+\keyword{misc}
diff --git a/man/zoomInPlot.Rd b/man/zoomInPlot.Rd
new file mode 100755
index 0000000..b7d9e58
--- /dev/null
+++ b/man/zoomInPlot.Rd
@@ -0,0 +1,44 @@
+\name{zoomInPlot}
+\alias{zoomInPlot}
+\title{
+ Display a plot with a rectangular section expanded in an adjacent plot
+}
+\description{
+ Display one plot on the left half of a device and an expanded section of that
+ plot on the right half of the device with connecting lines showing the expansion.
+}
+\usage{
+ zoomInPlot(x,y=NULL,xlim=NULL,ylim=NULL,rxlim=xlim,rylim=ylim,xend=NA,
+  zoomtitle=NULL,titlepos=NA,...)
+}
+\arguments{
+ \item{x,y}{numeric data vectors. If \samp{y} is not specified, it is set equal
+  to \samp{x} and \samp{x} is set to \samp{1:length(y)}.}
+ \item{xlim,ylim}{Limits for the initial plot.}
+ \item{rxlim,rylim}{Limits for the expanded plot. These must be within the above.}
+ \item{xend}{Where to end the segments that indicate the expansion. Defaults to
+  just left of the tick labels on the left ordinate.}
+ \item{zoomtitle}{The title of the plot, display in the top center.}
+ \item{titlepos}{The horizontal position of the title in user units of the
+  zoomed plot.}
+ \item{...}{additional arguments passed to \samp{plot}.}
+}
+\details{
+ \samp{zoomInPlot} sets up a two column layout in the current device and calls
+ \samp{plot} to display a plot in the left column. It then draws a rectangle
+ corresponding to the \samp{rxlim} and \samp{rylim} arguments and displays a
+ second plot of that rectangle in the right column. It is currently very simple
+ and will probably become more flexible in future versions.
+
+ It just has. If \samp{rxlim} is set to NA, \samp{locator} will be called and
+ the user can define the zoomed rectangle by clicking on each corner. This is a
+ shameless ripoff of a suggestion by Greg Snow on the help list. Thanks, Greg.
+}
+\value{nil}
+\author{Jim Lemon}
+\seealso{\link{plot}}
+\examples{
+ zoomInPlot(rnorm(100),rnorm(100),rxlim=c(-1,1),rylim=c(-1,1),
+  zoomtitle="Zoom In Plot",titlepos=-1.5)
+}
+\keyword{misc}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/r-cran-plotrix.git



More information about the debian-science-commits mailing list