ndgrid: Creates n-dimensional grids.

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

Creates an n dimensional grid given values in each coordinate direction.

Usage

1
ndgrid(..., use.array = FALSE, use.df = TRUE)

Arguments

...

Numeric vectors. The first arguments run faster than later ones.

use.array

Return result as a list of arrays?

use.df

Return result as a data.frame (if arr=FALSE)?

Details

Very often, rectangular grid is necessary given the coordinates along each direction resulting in the coordinates of each point in the grid. This function generalizes this such that it works for n-dimensional cubes.

Value

List with arrays.

Examples

1
2
3
4
5
6
g <- ndgrid(x=1:3, y=11:14)
print(g)
h <- ndgrid(x=1:3, y=11:14, z=101:102)
print(h)
w <- ndgrid(x=1:3, y=11:14, use.array=TRUE)
print(w)

tunelipt/wutils documentation built on Nov. 5, 2019, 11:01 a.m.