Data
- Opportunistic observations of Whooping cranes in Nebraska from 1988-2012
- Data is available from Data Dryad.
- Lets take a look at the data using the code below
## OGR data source with driver: ESRI Shapefile
## Source: "/private/var/folders/2x/rc9k5fxn2gx_gr790742wl3h0000gn/T/RtmpLaeQ5t/Nebraska/Nebraska.shp", layer: "Nebraska"
## with 1 features
## It has 8 fields
data.whooper <- data
data.whooper <- data.whooper[which(data.whooper$y == 1), ]
data.whooper <- data.whooper[rev(order(data.whooper$group.size)), ]
# head(data.whooper)
points = data.frame(x = data.whooper$lat, y = data.whooper$lon, z = data.whooper$group.size)
coordinates(points) = ~x + y
proj4string(points) <- CRS(projection(state))
breaks = c(0, 1, 2, 3, 4, 5, 10, 21)
classes = cut(data.whooper$group.size, breaks)
meds = tapply(data.whooper$group.size, classes, FUN = median)
sizes <- (meds/max(meds))^0.57 * 1.5
breaks = c(0, 1, 2, 3, 4, 5, 10, 21)
classes = cut(data.whooper$group.size, breaks)
meds = tapply(data.whooper$group.size, classes, FUN = median)
sizes <- (meds/max(meds))^0.57 * 1.5
l1 = list("SpatialPolygonsRescale", layout.scale.bar(), offset = c(-104, 40),
scale = 100/84.44, fill = c("transparent", "black"))
l2 = list("sp.text", c(-104, 40.25), "0")
l3 = list("sp.text", c(-102.7, 40.25), "100 km")
plot = spplot(points[, 1], colorkey = FALSE, cex = sizes, col.regions = bpy.colors(n = 100,
cutoff.tails = 0.5, alpha = 0.7), scales = list(draw = T), xlim = c(-104.3,
-95), ylim = c(39.75, 43.25), cuts = breaks, key.space = "right", alpha = 0.9,
legendEntries = c(1, 2, 3, 4, 5, "6-10", "11-21"), auto.key = list(cex = c(0.7),
title = "Group size"), sp.layout = list(l1, l2, l3)) + layer(sp.polygons(state))
print(plot)