Mercer and Hall wheat yield data, based on version in Cressie (1993), p. 455.
The format of the object generated by running
data(wheat) is a three column data frame made available by Hongfei Li. The example section shows how to convert this to the object used in demonstrating the
aple function, and is a:
Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots;
the data slot is a data frame with 500 observations on the following 6 variables.
local coordinates northings ordered north to south
Mercer and Hall wheat yield data
rows south to north; levels in distance units of plot centres
columns west to east; levels in distance units of plot centres
local coordinates eastings
local coordinates northings ordered south to north
The value of 4.03 was changed to 4.33 (wheat[71,]) 13 January 2014; thanks to Sandy Burden; cross-checked with http://www.css.cornell.edu/faculty/dgr2/teach/R/mhw.csv, which agrees.
Cressie, N. A. C. (1993) Statistics for Spatial Data. Wiley, New York, p. 455.
Mercer, W. B. and Hall, A. D. (1911) The experimental error of field trials. Journal of Agricultural Science 4, 107-132.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
## Not run: data(wheat) wheat$lat1 <- 69 - wheat$lat wheat$r <- factor(wheat$lat1) wheat$c <- factor(wheat$lon) wheat_sp <- wheat coordinates(wheat_sp) <- c("lon", "lat1") wheat_spg <- wheat_sp gridded(wheat_spg) <- TRUE wheat_spl <- as(wheat_spg, "SpatialPolygons") df <- as(wheat_spg, "data.frame") row.names(df) <- sapply(slot(wheat_spl, "polygons"), function(x) slot(x, "ID")) wheat <- SpatialPolygonsDataFrame(wheat_spl, data=df) ## End(Not run) require(maptools) wheat <- readShapeSpatial(system.file("etc/shapes/wheat.shp", package="spdep"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.