knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
library(topogram)

Create interactive topogram that you can update dynamically with a select menu.

First add select menu:

topogram_select(
  topogramId = "ID",
  sfobj = world,
  values = list(
    "Population" = "pop_est",
    "GDP" = "gdp_md_est", 
    "CO2 emissions (1990)" = "co2_emissions_1990", 
    "CO2 emissions (2020)" = "co2_emissions_2020", 
    "Share of electricity production from renewables" = "renewables_percent_electricity"
  ),
  label = "{name} : {value}"
)

Then create topogram:

topogram(
  sfobj = world,
  value = "pop_est", 
  label = "{name} : {value}",
  elementId = "ID"
)


dreamRs/topogRam documentation built on Dec. 16, 2021, 6:47 p.m.