# NOT RUN {
{
require(raster)
# read movement data
file <- system.file('extdata', 'konstanz_20130804.shp', package="rsMove")
moveData <- shapefile(file)
# read raster data
file <- list.files(system.file('extdata', '', package="rsMove"), 'tc.*tif', full.names=TRUE)
rsStk <- stack(file)
rsStk <- stack(rsStk, rsStk, rsStk) # dummy files for the example
# raster dates
rd = seq.Date(as.Date("2013-08-01"), as.Date("2013-08-09"), 1)
# sample dates
td = as.Date(moveData@data$date)
# perform directional sampling
of <- function(x,y) {lm(y~x)$coefficients[2]}
t.sample <- timeDirSample(xy=moveData, ot=td, img=rsStk, rt=rd, mws=10, dir="bwd", fun=of)
}
# }
Run the code above in your browser using DataLab