#' Create dataframe for siteTrans function
#'
#' @param data dataframe of Motus detection data containing at a minimum fullID, ts, lat, lon
#'
#' @author Zoe Crysler \email{zcrysler@@gmail.com}
#'
## site.fun and consec.fun adapted from "between.locs.R" script written by Phil
consec.fun <- function(df) {
df <- df[order(df$ts),]
a <- df$recvDeployName[-length(df$recvDeployName)]
b <- df$recvDeployName[-1]
tmp <- c(0, 1 - (as.numeric(a==b)))
run <- cumsum(tmp)
transitions <- which(diff(run) != 0)
transitions <- c(transitions, transitions+1, length(df$recvDeployName))
out.df <- df[transitions,]
out.df <- out.df[order(out.df$ts),]
return(out.df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.