getIndividualBoxIndices: Get the Halton Box Index for a point. If you pass discrete...

View source: R/MasterSample.r

getIndividualBoxIndicesR Documentation

Get the Halton Box Index for a point. If you pass discrete points to this function it will return the Halton Index according to the Master Sample as defined by the bounding box. If the points are closer together than the defined box size then they are treated as the same sample unit. We do not expect this to be spatially balanced and do not recommend using this function alone to select a sample.

Description

Get the Halton Box Index for a point. If you pass discrete points to this function it will return the Halton Index according to the Master Sample as defined by the bounding box. If the points are closer together than the defined box size then they are treated as the same sample unit. We do not expect this to be spatially balanced and do not recommend using this function alone to select a sample.

Usage

getIndividualBoxIndices(pts, J = NULL, bb, size = 100)

Arguments

pts

Shape file as a polygon (sp or sf) to generate the boxes for.

J

Definition for the number of grid cells of Halton frame.

bb

Bounding box which defines the Master Sample. Default is BC Marine Master Sample.

size

Physical target size of Halton boxes (square ish) if J is NULL.

Examples

## Not run: 
library(bcmaps)
# If you haven't already installed this:
install.packages('bcmapsdata', repos='https://bcgov.github.io/drat/')
library(bcmapsdata)
cities <- get_layer("bc_cities")
bb <- buildMS(hydro, d = 2, FALSE)
# For visibility will make boxes 10 km
cities.ord <- getIndividualBoxIndices(pts = cities, bb = bb, size = 100)
plot(st_geometry(cities), pch = 20)
plot(st_geometry(cities.ord[rank(cities.ord$HaltonIndex) < 15,]), add= TRUE, col = "red", cex = 1.5)

## End(Not run)

paul-vdb/DFO-master-sample documentation built on April 5, 2022, 4:35 p.m.