mkpredgrid2d {geoBayes} | R Documentation |
Make prediction grid
Description
This function creates a grid for prediction.
Usage
mkpredgrid2d(
pnts.x,
pnts.y,
par.x,
par.y,
isby = FALSE,
chull = FALSE,
exf = 1
)
Arguments
pnts.x |
x coordinate of the domain. Could also be a two-column matrix containing the x and y coordinates |
pnts.y |
y coordinate of the domain. Should be
omitted or set to |
par.x |
A scalar parameter for the x component of the new
grid. This parameter corresponds to either the |
par.y |
As in |
isby |
If |
chull |
Whether to calculate the convex hull of the points.
Set this to |
exf |
An expansion factor of the convex hull of
|
Details
If chull
this function first calculates the convex hull of
the points. If exf
is not 1 the borders are expanded. Then
the function calls point.in.polygon
to select
points that fall inside the borders.
Value
A list with components
-
grid
A two-column matrix with the prediction grid. -
xycoord
A list with components "x" and "y" containing the sequence of points used to create the grid. -
xygrid
A matrix with the full square grid derived fromxycoord
. -
borders
The (expanded) borders of the domain. -
inxygrid
A logical vector indicating which rows ofxycoord
fall insideborders
, and therefore correspond to thegrid
.
Examples
## Not run:
data(rhizoctonia)
predgrid <- mkpredgrid2d(rhizoctonia[c("Xcoord", "Ycoord")],
par.x = 100, chull = TRUE, exf = 1.2)
plot(predgrid$borders, type = "l") # Domain for prediction
points(predgrid$grid, pch = 20, cex = .3) # Prediction locations
points(rhizoctonia[c("Xcoord", "Ycoord")]) # Observed locations
## End(Not run)