Learn R Programming

smint (version 0.4.2)

randGrid: Random drawing of a Grid object

Description

Random drawing of a Grid object

Usage

randGrid(dim = 1L + rpois(1L, lambda = 3), nxMin = 1L, nxE = 4L, nlevels, dimNames)

Arguments

dim
The spatial dimension.
nxMin
Minimum number of nodes. Integer vector of length 1 or dim.example(Grid).
nxE
Expected number of nodes. Numeric vector of length 1 or dim.
nlevels
Integer vector giving the number of levels for each spatial dimension.
dimNames
Names of the spatial dimensions.

Value

An object with S4 class "Grid".

Details

The nodes are drawn by first choosing their number for each spatial dimension using a Poisson distribution, and then by drawing a sample of the uniform distribution with the suitable size.

See Also

Grid-class.

Examples

Run this code
set.seed(1234)
## specify dim: number of levels are random!
GD <- randGrid(dim = 4)
plot(GD)
## specify number of levels (hence dim)
GD2 <- randGrid(nlevels = c(2, 3, 4))
plot(GD2)

Run the code above in your browser using DataLab