# NOT RUN {
require(rgdal)
require(raster)
require(sp)
# read remote sensing data
file <- list.files(system.file('extdata', '', package="rsMove"), 'ndvi.tif', full.names=TRUE)
r.stk <- stack(file)
# read movement data
data(shortMove)
# observation time
obs.time <- strptime(paste0(shortMove@data$date, ' ', shortMove@data$time),
format="%Y/%m/%d %H:%M:%S")
# remove redundant samples
shortMove <- moveReduce(xy=shortMove, obs.time=obs.time, img=rsStk)$points
# retrieve remote sensing data for samples
rsQuery <- extract(rsStk, shortMove)
# identify unique sample regions
label <- labelSample(xy=shortMove, agg.radius=90, pixel.res=rsStk)
# select background samples
ind <- which(!is.na(label)) # selected samples
bSamples <- backSample(xy=shortMove[ind,], region.id=label[ind],
img=rsStk, sampling.method='pca')
# derive model predictions
out <- predictResources(presence.data=rsQuery,
absence.data=bSamples@data, sample.label=label, env.data=rsStk)
# }
Run the code above in your browser using DataLab