Draws a Halton Lattice sample from a linear (line) resource .
Description
Draws a Halton Lattice sample from a SpatialLines*
object.
Usage
1 2 
Arguments
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 
Details
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
).
Value
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 (seehalton.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 normalsampleID
's so they will sort the frame in the proper order. 
geometryID
: The ID of the line inx
on which each sample point falls. The ID of lines inx
arerow.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. Ifbalance=="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. Ifbalance=="2D"
, this is a random number between 0 and the number of points in the discretization ofx
(seeframe.spacing
). Ifbalance=="1D"
, this is a random number between 0 and the number of points in the 1D Halton lattice discretization ofx
(see parametersJ
andeta
). The sample consists of then
consecutive units starting atrandom.start+1
in the sorted Halton frame.
Author(s)
Trent McDonald
See Also
bas.line
, hal.point
, hal.polygon
,
sdraw
Examples
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)
