% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sptExtract.R
\name{sptExtract}
\alias{sptExtract}
\title{Extract spatio-temporal environmental data}
\usage{
sptExtract(locations, env_data, tres = "month")
}
\arguments{
\item{locations}{A spatial points data frame.}

\item{env_data}{A raster time series object.}

\item{tres}{A time interval.}
}
\value{
data frame with the environmental data for each location \code{lm}.
}
\description{
Function to extract spatio-temporal
environmental data for given locations and certain time interval.
}
\examples{
\dontrun{
# Read Species Data
library(climateNiche)
sp_data <- get(data("Equus_quagga"))

# Remove entries where no month is provided
sp_data <- sp_data[which(!is.na(sp_data$month)),]

# Get environmental data
prec <- raster::getData(name = "worldclim", var = "prec", res = 10)

sp_prec_mon <- sptExtract(sp_data, prec, tres="month")
sp_prec_qtr <- sptExtract(sp_data, prec, tres="quarter")
}
}
