Draws a Halton Lattice sample from a SpatialLines*
object.
1 2 
x 
A SpatialLines or SpatialLinesDataFrame object. This object must contain at least 1 line. If it contains more than 1 line, the HAL sample is drawn from the union of all lines. 
n 
Sample size. Number of locations to draw from the set of all lines
contained in 
J 
A 2X1 vector of base powers. 
eta 
When 
bases 
If 
balance 
Option specifying how spatial balance is maintained. The options are "1D" or "2D". Under "1D" all lines in Under "2D" a systematic sample of points along the union of all lines
in 
frame.spacing 
If 
A HAL sample is drawn from the union of all lines in x
by
discretization of lines using points spaced pt.spacing
apart. The
discretized points are then sampled using the HAL method
for points (see hal.point
).
A SpatialPointsDataFrame
containing locations in the HAL sample,
in HAL order.
Attributes of the sample points are:
sampleID
: A unique identifier for every sample point. This
encodes the HAL order. return[order(return$sampleID),]
will sort the
returned object in HAL order. sampleID
's, in the HAL case, are not
consecutive. sampleID
's are usually the Halton
indices for the Halton boxes
containing the point, after adding random cycles for multiple points in
the same box (see halton.frame
). If the sample
cycled around
to the beginning of the frame, because random start
fell at the end, the sample number is appended
to the beginning of the normal sampleID
's so they
will sort the frame in the proper order.
geometryID
: The ID of the line in x
on which each
sample point falls. The
ID of lines in x
are row.names(x)
.
Any attributes of the original lines (in x
).
Additional attributes of the output object, beyond those which
make it a SpatialPointsDataFrame
, are:
frame
: Name of the input sampling frame.
frame.type
: Type of resource in sampling frame. (i.e., "line").
sample.type
: Type of sample drawn. (i.e., "BAS").
balance
: The type of balance ("1d" or "2d").
random.start
: The random seed for the randomstart
1D or 2D Halton sequence
that produced the sample.
If balance=="1D"
,
random.start
: The random start of the sample in the
1D or 2D Halton
frame. The Halton frame is a list of all points sorted in
Halton order. Halton order is the Halton index of each point, with
random cycles added to multiple points
in the same Halton box. If balance=="2D"
,
this is a random number between 0 and the number of points
in the discretization of x
(see frame.spacing
).
If balance=="1D"
, this is a random number between 0
and the number of points in the 1D Halton lattice
discretization of x
(see parameters J
and eta
).
The sample consists of the
n
consecutive units starting at random.start+1
in
the sorted Halton frame.
Trent McDonald
bas.line
, hal.point
, hal.polygon
,
sdraw
1 2 3 4 5 6 7 8 9 10 11 12 13 14  # Default sample of Hawaii coastline. 1D balance
samp < hal.line( HI.coast, 100 )
# Desire frame with spacing = 500 meters
# Frame has ~3144 points = lineLength(HI.coast)/500
samp < hal.line( HI.coast, 100, balance="2D", frame.spacing=500)
# Desire 2000 points in frame
# Set frame.spacing = lineLength / 2000
# Set Halton lattice to contain
# 2592 boxes = prod(c(2,3)^c(5,4))
samp < hal.line( HI.coast, 100, J=c(5,4), balance="2D",
frame.spacing=lineLength(HI.coast)/2000)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.