dgmaxcell | R Documentation |
Cells are labeled 1-N. This function returns N. This is useful if you want to choose cells from the dggs randomly.
dgmaxcell(dggs, res = NA)
dggs |
A dggs object from dgconstruct() |
res |
If NA, use the resolution specified by the dggs. Otherwise, override the resolution. |
The maximum cell id.
#Choose a set of cells randomly distributed over the Earth
library(dggridR)
dggs <- dgconstruct(spacing=1000, metric=FALSE, resround='down')
N <- 100 #Number of cells
maxcell <- dgmaxcell(dggs) #Get maximum cell id
cells <- sample(1:maxcell, N, replace=FALSE) #Choose random cells
grid <- dgcellstogrid(dggs,cells) #Get grid
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.