Nothing
knitr::opts_chunk$set(echo = TRUE)
In this tutorial, we are going to combine the power of 3 R packages to create a nice visual for countries by their respective continents and their capitals.
quickcode::libraryAll( r2country, collapsibleTree, quietly = TRUE, clear = TRUE )
# use datasets of continent, country names, and capitals final.dt <- country_names for (cl in c( "country_continent", # continents "country_capital", # capitals "country_money", # currencies "country_population" # population )) { final.dt <- merge(final.dt, get(cl), by = "ID") } # preview the dataset names(final.dt) head(final.dt)
collapsibleTree( final.dt, hierarchy = c("continent", "name", "capital"), root = "Continents", width = 1800, fontSize = 15, height = 1000, zoomable = TRUE )
collapsibleTree( final.dt, hierarchy = c("continent", "name", "currency"), root = "Continents", width = 1800, fontSize = 15, height = 1000, zoomable = TRUE )
collapsibleTree( final.dt, hierarchy = c("continent", "name", "population2023"), root = "Continents", width = 1800, fontSize = 15, height = 1000, zoomable = TRUE )
collapsibleTree( final.dt, hierarchy = c("continent", "name", "isocode"), root = "Continents", width = 1800, fontSize = 15, height = 1000, zoomable = TRUE )
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.