% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_data.R
\name{get_data}
\alias{get_data}
\title{Get data points that lie inside a polygon}
\usage{
get_data(polygon, xy.dat)
}
\arguments{
\item{polygon}{A data frame of 2 columns ("x","y") that contain coordinates of polygon vertices.}

\item{xy.dat}{A data frame, containing "x" and "y" columns. Other columns may also be present.}
}
\value{
A filtered data frame.
}
\description{
This function extracts points from a provided dataset that lie inside a given polygon.
}
\note{
This function excludes points that are strictly outside the given
polygon. Points lying on the edges or vertices of the
polygon (if the polygon is not closed) will be included in the
filtered data frame.
}
\examples{
#Creating data.frame of a polygon
poly<- data.frame(c(3.38,3.30,1.70,0.78,-0.06,-2.30,-2.94,-3.97,-1.61,-0.39,0.68,1.28,1.60,3.38),
c(-0.12,-0.31,-2.73,-3.22,-3.29,-2.19,-1.62,0.94,3.10,3.00,2.91,2.49,2.20,-0.12))

#Creating a data set of points
xy.dat<-data.frame(x=runif(250,-4,4),y=runif(250,-4,4))
plot(poly,type='l',xlab="X",ylab="Y")
points(xy.dat)

#Extracting points that lie inside a polygon
points(get_data(poly,xy.dat),pch=19,col=2)
}
\author{
Liudas Daumantas
}
