R/data_agent.R

#' data_agent
#'
#' \code{data_agent} provides the options for the presence of police agents in the shootings
#'
#' @param \code{add_token}: add the user's token to access the API.
#' @usage data_agent(add_token=xxxx)
#' @return it returns a dataframe of with the options for the presence of police agents in the shootings. The values
#' can be used to filter the cases in the function \code{get_occurrences}
#' #' @examples
#' data_agent()
#' @import httr
#' @import rvest
#' @import purrr
#' @import jsonlite
#' @import tibble
#' @importFrom magrittr "%>%"
#' @export


data_agent <- function(add_token){

  endpoint <- "/security-agent-presence"

  response <- httr::GET(paste0(base, endpoint),
                        add_headers('Authorization' = paste("Bearer", add_token, sep = " ")))

  jsonlite::fromJSON(httr::content(response, as="text")) %>% tibble::as_tibble()


}
TiagoVentura/get_fogocruzado documentation built on June 27, 2019, 12:19 a.m.