Google Charts gauge

The gauge with GDP per capita is from the excellent Google Charts API. More information on this can be found at developers.google.com/chart/. Fortunately for us, there is an R package to interface with Google Charts, so there is no need to get our hands dirty with a different API. The package is on CRAN and can be installed with install.packages("googleVis").

Install and load it now. The code is as follows:

  output$gauge = renderGvis({        infoGDP = theData() %>%      filter(year == 2007) %>%      group_by(continent) %>%      filter(continent == input$continent) %>%      pull(gdpPercap) %>%      mean() %>%      round(0)        df = data.frame(Label = "GDP", Value = infoGDP)        gvisGauge(df,              options = list(min = 0, max = 50000,  greenFrom = 5000, greenTo = 50000, ...

Get Web Application Development with R Using Shiny - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.