Richard Hardy
2020-01-31
This app functions in 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.
By moving the slider (or by clicking the right arrowkey to move forward through time), the app displays the general improvements in health and wealth globally.
Part 2:
Part 1: sample output for 1952
Part 2: Sample output: China
[1] 1138.39
Thank you for watching.
reactive code chunk in server.R : % 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
})
})