This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' @title Find the sections of a path that pass thorugh a restricted area | |
#' @description This function is used to identify sections of a path that pass through | |
#' restricted areas. the CTCRW model in crawl cannot actively steer paths away | |
#' from restricted areas as it knows nothing of spatial information. So, this function | |
#' will identify areas that for which the unrestrained path passes through these areas. | |
#' If the path/points end within the restricted area, those records will be removed. | |
#' The user can then use this information to adjust the path as desired. | |
#' @param xy A \code{SpatialPoints} object from the \code{sp} package or a | |
#' 2-column matrix of x and y locations | |
#' @param res_raster A \code{raster} object from the raster package that indicates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(glmmTMB) | |
library(mgcv) | |
######################################################################### | |
## Function to create prediction matrices from mgcv for glmmTMB | |
## from ?mgcv::smooth2random | |
######################################################################## | |
s2rPred <- function(sm,re,data) { | |
## Function to aid prediction from smooths represented as type==2 | |
## random effects. re must be the result of smooth2random(sm,...,type=2). |
OlderNewer