R/API.R

Defines functions meteroitesapi

Documented in meteroitesapi

#API
#'@title meteroitesapi
#'@description
#'meteroitesapi is a function to downlaod the meteroites data from the NASA SODA API.
#'It returns a data frame.
#'@usage
#'meteroitesapi()
#'@return
#'Returns a data frame with the meteroites data.
#'@export
meteroitesapi <- function(){
  weburl <- "https://data.nasa.gov/resource/gh4g-9sfh.csv"
  access <- httr::GET(weburl)
  meteroitesData <- readr::read_csv(httr::content(access, as = "text", type = "csv", encoding = "UTF-8"))
  check <- httr::status_code(access)
  if(check!=200){
    print("Please refresh the page or check your internet connection")
  }

  return(meteroitesData)

}
unimi-dse/09ea9da6 documentation built on Feb. 17, 2020, 4:16 a.m.