# Helper function 1: Parse one year's data, and return a tibble
saipe_parse = function(url){
resp = httr::GET(url)
if (resp$status_code != 200) stop("HTTP failure: ", resp$status_code, call. = FALSE)
text = httr::content(resp, "text")
if (identical(text, "")) stop("No output to parse", call. = FALSE)
parsed = jsonlite::fromJSON(text, simplifyVector = TRUE)
parsed = as.data.frame(parsed, stringAsFactors = FALSE)
tf_csv = tempfile(fileext = ".csv")
readr::write_csv(parsed, tf_csv)
suppressMessages(readr::read_csv(tf_csv, skip = 1))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.