db.grid2point.sampling {RGeostats} | R Documentation |
Extract samples from a regular grid
db.grid2point.sampling(dbgrid, names = db.getname(dbgrid, "z", 1), npack = 3, npcell = 1, nmini = 1)
dbgrid |
The |
names |
The list of variables which will be copied in the resulting Db. |
npack |
Number of cells of the fine input grid that are regrouped to form a cell from which one or several samples are randomly selected. This argument should be a vector with a dimension equal to the space dimension of 'dbgrid' argument. If dimension do not match, the value of the first element of 'npacks' is duplicated. |
npcell |
Number of samples extracted for each cell. |
nmini |
No sample is extracted if the number of grid nodes per cell is smaller than 'nmini' |
A coarse grid of cells is overlaid to the initial fine grid. The dimension of the cell is equal to the dimension of the fine grid multiplied by 'nfacts'. Per cell, 'npcell' nodes are randomly chosen. Their collection form the returned data base.
The returned db-class
(organized as isolated points) with the
following variables:
The coordinates
The variables designated by the 'names' argument
grid = db.create(nx=c(30,30)) grid = db.add(grid,z1=runif(grid$nech)) db = db.grid2point.sampling(grid,npack=5) plot(grid,name.post="rank",flag.aspoint=TRUE,pch=1) plot(db,name.post="rank",add=TRUE,col="blue",pch=19) rm(grid,db)