xy.grid {sfsmisc} | R Documentation |
Produce Regular Grid Matrix
Description
Produce the grid used by persp
, contour, etc, as
an N x 2
matrix.
This is really outdated by expand.grid()
nowadays.
Usage
xy.grid(x, y)
Arguments
x , y |
any vectors of same mode. |
Value
a 2-column matrix of “points” for each combination of x
and
y
, i.e. with length(x) * length(y)
rows.
Author(s)
Martin Maechler, 26 Oct 1994.
See Also
expand.grid
which didn't exist when
xy.grid
was first devised.
Examples
plot(xy.grid(1:7, 10*(0:4)))
x <- 1:3 ; y <- 10*(0:4)
xyg <- xy.grid(x,y)
## Compare with expand.grid() :
m2 <- as.matrix(expand.grid(y,x)[, 2:1])
dimnames(m2) <- NULL
stopifnot(identical(xyg, m2))
[Package sfsmisc version 1.1-18 Index]