Richard Hardy
2020-02-01
This app has two parts:
Part 1:
The app displays countries' GDP per capita and life expectancy in years from birth as recorded across 5-year intervals between 1952 and 2007.
Moving the slider (or clicking through using the right arrowkey), reveals the general improvements in health and wealth globally over the second half of the 20th century.
Part 2:
Part 1: sample output for 1952
Part 2: Sample output: China
[1] "% 1138.39"
Thank you for watching and I hope you enjoy exploring the Gapminder data with this app
Hans Rosling's TED talk is the inspiration for this project, and r ?gapminder will give the source code used to build the global plot.
Enjoy!
reactive expression code in server.R : GDP change (%) calculation
shinyServer(function(input, output) {
percentchange <- reactive({
countryInput <- input$country
(gapminder$gdpPercap[gapminder$country ==
as.character(countryInput) & gapminder$year == 2007] -
gapminder$gdpPercap[gapminder$country ==
as.character(countryInput) & gapminder$year == 1952] ) /
gapminder$gdpPercap[gapminder$country ==
as.character(countryInput) & gapminder$year == 1952] * 100
})
})