polyprep {hacks}R Documentation

Plot polygons with missing data

Description

Formats data with missing values to be plotted with the polygon function.

Usage

polyprep(x1, x2 = NULL)

Arguments

x1 a numeric vector.
x2 an optional second vector. If unspecified, it will be set equal to x1.

Details

polyprep is designed to be used in conjuction with polygon when missing values are found in the data. The default behavior is to split x1 into pieces at each occurance of missing values, then combine these pieces with the reverse of x2, and then reassembled the pieces back into a single vector.

Author(s)

Nathan Stephens

See Also

polygon, split.

Examples

y <- c(LakeHuron)
y <- ifelse(y > 580, NA, y-min(y))
yy <- polyprep(y, -y)
xx <- as.numeric(names(yy))
plot(xx, yy, type = 'n')
polygon(xx, yy, col = 2)

[Package hacks version 0.1-5 Index]