Package desplot. R topics documented: April 3, 2018

Similar documents
Package ECctmc. May 1, 2018

Package fastdummies. January 8, 2018

Package areaplot. October 18, 2017

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package docxtools. July 6, 2018

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package basictrendline

Package ClustGeo. R topics documented: July 14, Type Package

Package smoothr. April 4, 2018

Package Mondrian. R topics documented: March 4, Type Package

Package spark. July 21, 2017

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package bisect. April 16, 2018

Package lucid. August 24, 2018

Package pairsd3. R topics documented: August 29, Title D3 Scatterplot Matrices Version 0.1.0

Package hextri. April 22, 2016

Package superheat. February 4, 2017

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package splines2. June 14, 2018

Package sankey. R topics documented: October 22, 2017

Package balance. October 12, 2018

Package postgistools

Package qicharts2. March 3, 2018

Package datasets.load

Package vinereg. August 10, 2018

Package meme. November 2, 2017

Package qicharts. October 7, 2014

Package pdfsearch. July 10, 2018

Package validara. October 19, 2017

Package deductive. June 2, 2017

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package kdtools. April 26, 2018

Package rsppfp. November 20, 2018

Package messaging. May 27, 2018

Package zoomgrid. January 3, 2019

Package canvasxpress

Package gridextra. September 9, 2017

Package nngeo. September 29, 2018

Package qualmap. R topics documented: September 12, Type Package

Package meme. December 6, 2017

Package omu. August 2, 2018

Package harrypotter. September 3, 2018

Package JBTools. R topics documented: June 2, 2015

Package weco. May 4, 2018

Package rtsplot. September 15, 2018

Package vip. June 15, 2018

Package SEMrushR. November 3, 2018

Package rollply. R topics documented: August 29, Title Moving-Window Add-on for 'plyr' Version 0.5.0

Package grimport. R topics documented: February 20, 2015

Package lvplot. August 29, 2016

Package QCAtools. January 3, 2017

Package pca3d. February 17, 2017

Package nonmem2r. April 5, 2018

Package strat. November 23, 2016

Package mixphm. July 23, 2015

Package pwrab. R topics documented: June 6, Type Package Title Power Analysis for AB Testing Version 0.1.0

Package readxl. April 18, 2017

Package narray. January 28, 2018

Package pathdiagram. R topics documented: August 29, 2016

Package sizemat. October 19, 2018

Package dynsim. R topics documented: August 29, 2016

Package eply. April 6, 2018

Package preprosim. July 26, 2016

Package goodpractice

Package NFP. November 21, 2016

Package splithalf. March 17, 2018

Package multigraph. R topics documented: November 1, 2017

Package stlplus. August 29, 2016

Package OLScurve. August 29, 2016

Package jdx. R topics documented: January 9, Type Package Title 'Java' Data Exchange for 'R' and 'rjava'

Package arphit. March 28, 2019

Package grec. R topics documented: August 13, Type Package

Package gtrendsr. August 4, 2018

Package gameofthrones

Package CorporaCoCo. R topics documented: November 23, 2017

Package multigraph. R topics documented: January 24, 2017

Package queuecomputer

Package shinyfeedback

Package BiocManager. November 13, 2018

Package edfreader. R topics documented: May 21, 2017

Package waterfall. R topics documented: February 15, Type Package. Version Date Title Waterfall Charts in R

Package barcoder. October 26, 2018

Package memery. February 13, 2018

Package osrm. November 13, 2017

Package Grid2Polygons

Package gtrendsr. October 19, 2017

Package widyr. August 14, 2017

Package editdata. October 7, 2017

Package lumberjack. R topics documented: July 20, 2018

Package reval. May 26, 2015

Package zebu. R topics documented: October 24, 2017

Package robotstxt. November 12, 2017

Package ConvergenceClubs

Package calpassapi. August 25, 2018

Package panelview. April 24, 2018

Package epitab. July 4, 2018

Package tiler. June 9, 2018

Package svalues. July 15, 2018

Package gridgraphics

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Transcription:

Package desplot April 3, 2018 Title Plotting Field Plans for Agricultural Experiments Version 1.4 Date 2018-04-02 Type Package Description A function for plotting maps of agricultural field experiments that are laid out in grids. Imports grid, lattice, reshape2, Suggests agridat, knitr, testthat License GPL-3 LazyData yes URL https://github.com/kwstat/desplot BugReports https://github.com/kwstat/desplot/issues VignetteBuilder knitr RoxygenNote 6.0.1 NeedsCompilation no Author Kevin Wright [aut, cre] (<https://orcid.org/0000-0002-0617-8673>) Maintainer Kevin Wright <kw.stat@gmail.com> Repository CRAN Date/Publication 2018-04-03 15:05:18 UTC R topics documented: desplot............................................ 2 panel.outlinelevelplot.................................... 4 RedGrayBlue........................................ 5 Index 7 1

2 desplot desplot Plot the layout/data of a field experiment. Description Usage Note, not all lattice parameters are passed down to xyplot, but it is possible to make almost any change to the plot by assigning the desplot object to a variable and then edit the object by hand or use update to modify the object. Then print it manually. See the first example below. desplot(form = formula(null ~ x + y), data, num = NULL, col = NULL, text = NULL, out1 = NULL, out2 = NULL, col.regions = RedGrayBlue, col.text = NULL, text.levels = NULL, out1.gpar = list(col = "black", lwd = 3), out2.gpar = list(col = "yellow", lwd = 1, lty = 1), at, midpoint = "median", ticks = FALSE, flip = FALSE, main = NULL, xlab, ylab, shorten = "abb", show.key = TRUE, key.cex, cex = 0.4, strip.cex = 0.75, subset = TRUE,...) Arguments form data num col text out1 out2 col.regions col.text text.levels out1.gpar out2.gpar at midpoint ticks flip main xlab A formula like yield~x*y location. Note x,y are numeric. A data frame. The name of the column of the data to use for plotting numbers. Column of the data for the color of the number shown in each cell. Column of the data to use for text labels shown in each cell. Column of the data to use for outlining around blocks of cells. Column of the data to use for outlining around blocks of cells. Colors for the fill color of cells. Vector of colors for text strings. Character strings to use instead of default levels. A list of graphics parameters for outlining. Can either be an ordinary list() or A call to gpar() from the grid package. Graphics parameters for the second level of outlining. Breakpoints for the color ribbon. Use this instead of zlim. Note: using at causes midpoint to be set to NULL. Method to find midpoint of the color ribbon. One of midrange, median, or a numeric value. If TRUE, show tick marks along the bottom and left sides. If TRUE, vertically flip the image. Main title. Label for x axis.

desplot 3 ylab Label for y axis. shorten Method for shortening text in the key, either abb, sub, no, or FALSE. show.key If TRUE, show the key on the left side. (This is not the ribbon.) key.cex Left legend cex. cex Expansion factor for text/number in each cell. strip.cex Strip cex. subset An expression that evaluates to logical index vector for subsetting the data.... Other. Details Ryder (1981) discusses the need to examine the layout of the experiment design, and not just the data. This function provides a a tool for plotting the layout of a field experiment and also the observed data. Use col.regions to specify fill colors. This can either be a vector of colors or a function that produces a vector of colors. If the response variable is a factor and col.regions is a function, it will be ignored and the cells are filled with default light-colored backgrounds and a key is placed on the left. If the response variable is numeric, the cells are colored according to col.regions, and a ribbon key is placed on the right. The default argument shorten='abb' will shorten the cell text using the abbreviate function. Use shorten='sub' to use a 3-character substring. Use shorten='no' or shorten=false for no shortening. Note that two sub-plots with identical levels of the split-plot factor can be adjacent to each other by virtue of appearing in different whole-plots. To correctly outline the split-plot factor, simply concatenate the whole-plot factor and sub-plot factor together. To get a map of a field with a true aspect ratio, include aspect=ylen/xlen in the call, where ylen is the vertical length of the field and xlen is the horizontal length of the field. To call this function inside another function, you can hack like this: vr <- "yield"; vx <- "x"; vy <- "y"; eval(parse(text=paste("desplot(", vr, "~", vx, "*", vy, ", data=yates.oats)"))) Value A lattice object Author(s) Kevin Wright References K. Ryder (1981). Field plans: why the biometrician finds them useful. Experimental Agriculture, 17, 243 256.

4 panel.outlinelevelplot Examples if(require(agridat)){ # Show how to customize any feature. Here: make the strips bigger. data(besag.met) dat <- besag.met d1 <- desplot(yield ~ col*row county, dat, main="besag.met", out1=rep, out2=block, out2.gpar=list(col="white"), strip.cex=2) d1 <- update(d1, par.settings = list(layout.heights=list(strip=2))) print(d1) # Show experiment layout data(yates.oats) # agridat version 1.12 used x/y here instead of col/row if(is.element("x",names(yates.oats))) yates.oats <- transform(yates.oats, col=x, row=y) desplot(yield ~ col+row, yates.oats, out1=block, out2=gen) desplot(block ~ col+row, yates.oats, col=nitro, text=gen, cex=1, out1=block, out2=gen, out2.gpar=list(col = "gray50", lwd = 1, lty = 1)) # Example from Ryder. data(ryder.groundnut) gnut <- ryder.groundnut m1 <- lm(dry~block+gen, gnut) gnut$res <- resid(m1) # Note largest positive/negative residuals are adjacent desplot(res ~ col + row, gnut, text=gen, cex=1, main="ryder.groundnut residuals from RCB model") } panel.outlinelevelplot Panel Function for desplot Description This is a panel function for desplot which fills cells with a background color and adds outlines around blocks of cells. Usage panel.outlinelevelplot(x, y, z, subscripts, at,..., alpha.regions = 1, out1f, out1g, out2f, out2g)

RedGrayBlue 5 Arguments x y z subscripts at Details... Other alpha.regions out1f out1g out2f out2g Coordinates Coordinates Value for filling each cell. For compatability. Breakpoints for the colors. Transparency for fill colors. Not well tested. Factors to use for outlining. Factors to use for outlining. Graphics parameters to use for outlining. Graphics parameters to use for outlining. It does not add the text labels, numbers, or colors. The rule for determining where to draw outlines is to compare the levels of the factor used for outlining. If bordering cells have different levels of the factor, then a border is drawn. NA values are ignored (otherwise, too many lines would be drawn). The code works, but is probably overkill and has not been streamlined. References Derived from lattice::panel.levelplot RedGrayBlue Function to create a Red-Gray-Blue palette Description A function to create a Red-Gray-Blue palette. Usage RedGrayBlue(n) Arguments n Number of colors to create Details Using gray instead of white allows missing values to appear as white (actually, transparent).

6 RedGrayBlue Value A vector of n colors. Author(s) Kevin Wright Examples pie(rep(1,11), col=redgrayblue(11)) title("redgrayblue(11)")

Index desplot, 2 panel.outlinelevelplot, 4 RedGrayBlue, 5 7