Learn R Programming

ads (version 1.4)

inside.swin: Test wether points are inside a sampling window

Description

Function inside.swin tests whether points lie inside or outside a given sampling window.

Usage

inside.swin(x, y, w, bdry=TRUE)

Arguments

x
a vector of x coordinates of points.
y
a vector of y coordinates of points.
w
an object of class "swin" (see swin) defining the sampling window.
bdry
by default bdry = TRUE. If FALSE, points located on the boundary of the sampling window are considered to be outside.

Value

  • A logical vector whose ith entry is TRUE if the corresponding point $(x[i],y[i])$ is inside w, FALSE otherwise.

encoding

latin1

See Also

swin.

Examples

Run this code
data(BPoirier)
  BP <- BPoirier
  wr <- swin(BP$rect)
  sum(inside.swin(BP$trees$x, BP$trees$y, wr))
  
  wc <- swin(c(55,45,45))
  sum(inside.swin(BP$trees$x, BP$trees$y, wc))
  
  wrt <- swin(BP$rect, triangles=BP$tri1)
  sum(inside.swin(BP$trees$x, BP$trees$y,wrt))

Run the code above in your browser using DataLab