Revision 392ae21a013fb3f518e8f9eb8efb458a55a2eca2 authored by HwB on 09 April 2011, 00:00:00 UTC, committed by Gabor Csardi on 09 April 2011, 00:00:00 UTC
1 parent 162b332
meshgrid.R
##
## m e s h g r i d . R Generate a Mesh Grid
##
meshgrid <- function(x, y = x) {
if (!is.numeric(x) || !is.numeric(y))
stop("Arguments 'x' and 'y' must be numeric vectors.")
x <- c(x); y <- c(y)
n <- length(x)
m <- length(y)
X <- matrix(rep(x, each = m), nrow = m, ncol = n)
Y <- matrix(rep(y, times = n), nrow = m, ncol = n)
return(list(X = X, Y = Y))
}
Computing file changes ...