library("rds.r") library("knitr")
Setting up the connection to the RDS server is the starting point to interacting with the RDS API through R. It provides an entry point to the API and will facilitate the handling of API calls for catalogs and data products.
# set up the base URL url = "https://public.richdataservices.com/rds" # connect to the server rds <- get.rds(url)
The server will come with some basic information about it.
properties <- c("Name", "Version", "Base URL", "Disclaimer") df <- data.frame(rds@name, rds@version, rds@baseUrl, rds@disclaimer) names(df) <- properties kable(df)
The server provides an entry point for users to view the catalog. We can get all the catalogs at once or a specific catalog by passing in the catalog id.
catalogs <- rds.r::getCatalogs(rds) catalogDf <- data.frame() for (catalog in catalogs) { df <- data.frame( catalog@id, catalog@name, catalog@label, catalog@description, catalog@dataProductCount ) catalogDf <- rbind(catalogDf, df) } names(catalogDf) <- c("ID", "Name", "Label", "Description", "# Data Products") kable(catalogDf)
catalog <- rds.r::getCatalog(rds, "covid19") df <- data.frame( catalog@id, catalog@name, catalog@label, catalog@description, catalog@dataProductCount ) names(df) <- c("ID", "Name", "Label", "Description", "# Data Products") kable(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.