Description Usage Arguments Value Author(s) See Also Examples
Makes a Halton frame from a set of points that have their Halton indices attached. This function identifies points in the same Halton box, and randomly adds Halton cycles to geographically separate nearby points. The frame is then sorted by the new frame indices for sampling.
1 | halton.frame(x, index.name = attr(x, "index.name"), order.name = "HaltonOrder")
|
x |
Either a data frame or a |
index.name |
Name of the Halton index column in the input object. This
names the column of |
order.name |
Name of the Halton order column in the output object. See description of returned object. This parameter is saved as an attribute of the output object. |
A data frame or SpatialPointsDataFrame
suitable for use as
a sampling frame. The data frame, or attributes of the points,
contain a new index column separating points in the same Halton box, and the
output is sorted by this new index. Returned object has the following
attributes,
index.name
: Name of the Halton index column used to construct
the frame.
order.name
: The name of the Halton ordering column.
This column is unique across rows of the output, and orders
the output frame, but is not consecutive. This differs from column
index.name
because points with identical index.name
indices have been randomly moved to the end of the frame by adding
random Halton cycles.
J
: Halton base powers defining lattice of Halton boxes,
if x
has a J
attribute.
bases
: Base powers defining lattice of Halton boxes,
if x
has a bases
attribute.
hl.bbox
: Bounding box for lattice of Halton boxes,
if x
has a hl.bbox
attribute.
Trent McDonald
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # The following is equivalent to hal.point(WA.cities,20,J=c(6,3))
# Define Halton lattice
attr(WA.cities,"J") <- c(6,3)
attr(WA.cities,"bases") <- c(2,3)
# Add tiny amount to right and top of bounding box because Halton boxes are
# closed on the left and bottom. This includes points exactly on top and right
# bounding lines.
attr(WA.cities,"hl.bbox") <- bbox(WA.cities) + c(0,0,1,1)
# Compute Halton indices
frame <- halton.indices( WA.cities )
# Separate points in frame that are in same box
frame <- halton.frame( frame )
# Draw sample of size 20
n <- 20
random.start <- floor( runif(1,0,nrow(frame)-1 ) )
samp <- frame[ ( ((0:(n-1))+random.start) %% nrow(frame) ) + 1, ]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.