db.grid.init {RGeostats} | R Documentation |

Initialize a Grid Data Base calculated from an already existing Db or a Polygon

db.grid.init(obj, nodes = NA, origin=NA, extend=NA, margin=0, flag.regular=TRUE, randperc=100)

`obj` |
The alreay existing R object used to determine the offset of the new
Grid Db. This object must be either a |

`nodes` |
Array containing the number of cells on each axis. If not defined, a constant value is provided, equal to 10. If a constant is entered, this same value is used for each axis. |

`origin` |
When provided, this array overwrites the origin as calculated from the input Db |

`extend` |
When provided, this array overwrites the extension as calculated from the input Db |

`margin` |
This array provides the percentage by which the initial extension must be multiplied to calculate the margin. The margin is expressed in percentage. This may be either an array (of dimension ndim) or a constant value which will be considered for each direction. If the argument 'origin' is not provided, the minimum (along each axis) is decreased by this margin. If the argument 'extend' is not provided, the extension (along each axis) is increased by this margin multiplied by 1 (if the origin is defined) or 2 otherwise. |

`flag.regular` |
When TRUE, the output is a regular grid. When FALSE, the output is a stratified grid: the set of output 'nodes' is obtained by randomizing each node within the cell to which it belongs. The output Db can be read as a standard grid, but is also contains additional coordinate vectors corresponding to the startified points. |

`randperc` |
When the flag.regular is switched OFF, this value gives the amount of randomization. If set to 100, the grid node may vary uniformely within [x0-r*dx/2; x0+r*dx/2] (where 'x' stands for the initial node coordinate, 'dx' is the grid mesh and 'r'is equal to the argument 'randperc' divided by 100. The argument 'randperc' must be positive. There is no check that 'randperc' not larger than 100 |

The `db-class`

newly created. This Db is organized as a Regular Grid. However, when flag.regular=FALSE, it also contain coordinate variables (called Strate.x*) which correspond to the coordinates of the stratified points.

[Package *RGeostats* version 11.0.6 Index]