library(jsonlite)
library(data.tree)
rm(list = ls())
file <- system.file("extdata", "categories.json", package = "gtrendsR")
res <- fromJSON(file, simplifyDataFrame = FALSE)
res <- as.Node(res)
categories <- ToDataFrameTree(res, "name", "id")
categories <- na.omit(categories)
categories <- categories[, c("name", "id")]
categories$name <- iconv(categories$name, to = "ASCII//TRANSLIT")
categories$id <- as.character(categories$id)
devtools::use_data(categories, overwrite = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.