R/get_province.R

Defines functions get_province

Documented in get_province

#' @title Statistics on Species or Infraspecies by Province from Catalogue of Life China checklist
#' @description Download the statistics datasets on species/infraspecies by province at \url{http://sp2000.org.cn/statistics/statistics_map} for more details.
#' @rdname  get_province
#' @name get_province
#' @return Statistics on species or infraspecies by province.
#' @details Visit the website \url{http://sp2000.org.cn/statistics/statistics_map} for more details.
#' @importFrom jsonlite fromJSON
#' @importFrom tibble tibble
#' @author Liuyong Ding \email{ly_ding@126.com}
#' @examples
#' \dontrun{
#' get_province()
#'
#' }
#' @export
get_province <- function() {
  cat(sprintf("last Update: %s",Sys.Date()),sep = "\n")
  url <- 'http://sp2000.org.cn/statistics/show_in_map_all'
  map_all <- jsonlite::fromJSON(url)
  map_all <- map_all$data
  names(map_all) <- c("province","species_counts")
  map_all$date <- as.Date(Sys.time())
  return(tibble(map_all))
}

Try the SP2000 package in your browser

Any scripts or data that you put into this service are public.

SP2000 documentation built on Nov. 8, 2020, 4:41 p.m.