R/map_sp_data.R

Defines functions map_sp_data

#' Map species data
#'
#' @param spp_data species data
#' @param crs coordinate system
#' @param zcol column name to show in colour; set NULL if not needed.
#' @param only_presences Show only presence points
#'
#' @return
#' @export
#'
#' @examples
map_sp_data <- function(spp_data, crs = 3577, zcol = "Value", only_presences = FALSE){
  dt <- spp_data$data
  zcol <- zcol[1]
  if(! zcol %in% names(dt))
    zcol <- NULL
  if(only_presences)
    dt <- dplyr::filter(dt, Value == 1)
  occurrence <- sf::st_as_sf(dt, coords = c("Longitude", "Latitude"), crs = crs)
  mapview::mapview(occurrence, zcol = zcol)
}
Doi90/bushfireSOS documentation built on Sept. 12, 2021, 10:54 a.m.