#' @title whichEventsVincenty
#' @description Uses Vincenty Formula to Determine Distances between points
#' @param \code{radius} km
#' @family abysmally documented
#' @author unknown, \email{<unknown>@@dfo-mpo.gc.ca}
#' @export
whichEventsVincenty <- function(lonlat,events,radius) {
cat('Uses Vincenty Formula to Determine Distances between points \n')
cat('radius is in km \n')
if(length(which((names(events) %in% c('lon','lat'))))!=2) {
cat('events need to be a data.frame and must contain columns named c(lon,lat)\n')
stop()
}
po <- data.frame(lon=lonlat[1],lat=lonlat[2])
events$D <- vincenty(loc1=po,loc2=events,a=6378.13700, f= 1/298.257223563)
return(events[which(events$D<radius),])
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.