Make the perfect plot using Shiny

Case Studies: Building Web Applications with Shiny in R

Dean Attali

Shiny Consultant

Re-plotting using R code

make_figure(
  data   = data1,
  size   = 1,
  colour = "black",
  title  = "GDP vs life exp"
)

chapter2_1_gapminder_dataset.003.png

Case Studies: Building Web Applications with Shiny in R

Re-plotting using R code

make_figure(
  data   = data1,
  size   = 2,
  colour = "black",
  title  = "GDP vs life exp"
)

chapter2_1_gapminder_dataset.004.png

Case Studies: Building Web Applications with Shiny in R

Re-plotting using R code

make_figure(
  data   = data1,
  size   = 2,
  colour = "darkblue",
  title  = "GDP vs life exp"
)

chapter2_1_gapminder_dataset.005.png

Case Studies: Building Web Applications with Shiny in R

Re-plotting using R code

make_figure(
  data   = data1,
  size   = 2,
  colour = "darkblue",
  title  = "GDP vs Life Expectancy"
)

chapter2_1_gapminder_dataset.006.png

Case Studies: Building Web Applications with Shiny in R

Re-plotting using R code

make_figure(
  data   = data2,
  size   = 2,
  colour = "darkblue",
  title  = "GDP vs Life Expectancy"
)

chapter2_1_gapminder_dataset.007.png

Case Studies: Building Web Applications with Shiny in R

Re-plotting using Shiny

chapter2_1_gapminder_dataset.008.png

Case Studies: Building Web Applications with Shiny in R

Re-plotting using Shiny

chapter2_1_gapminder_dataset.009.png

Case Studies: Building Web Applications with Shiny in R

Re-plotting using Shiny

chapter2_1_gapminder_dataset.010.png

Case Studies: Building Web Applications with Shiny in R

Re-plotting using Shiny

chapter2_1_gapminder_dataset.011.png

Case Studies: Building Web Applications with Shiny in R

Re-plotting using Shiny

chapter2_1_gapminder_dataset.012.png

Case Studies: Building Web Applications with Shiny in R

Gapminder dataset

country continent year lifeExp pop gdpPercap
Netherlands Europe 2002 78.530 16122830 33724.758
Turkey Europe 1987 63.108 52881328 5089.044
Oman Asia 1987 67.734 1593882 18115.223
Jamaica Americas 1982 71.210 2298309 6068.051
Algeria Africa 1967 51.407 12760499 3246.992
Case Studies: Building Web Applications with Shiny in R

Gapminder dataset

country continent year lifeExp pop gdpPercap
Netherlands Europe 2002 78.530 16122830 33724.758
Turkey Europe 1987 63.108 52881328 5089.044
Oman Asia 1987 67.734 1593882 18115.223
Jamaica Americas 1982 71.210 2298309 6068.051
Algeria Africa 1967 51.407 12760499 3246.992
Case Studies: Building Web Applications with Shiny in R

Gapminder dataset

country continent year lifeExp pop gdpPercap
Netherlands Europe 2002 78.530 16122830 33724.758
Turkey Europe 1987 63.108 52881328 5089.044
Oman Asia 1987 67.734 1593882 18115.223
Jamaica Americas 1982 71.210 2298309 6068.051
Algeria Africa 1967 51.407 12760499 3246.992
Case Studies: Building Web Applications with Shiny in R

Gapminder dataset

country continent year lifeExp pop gdpPercap
Netherlands Europe 2002 78.530 16122830 33724.758
Turkey Europe 1987 63.108 52881328 5089.044
Oman Asia 1987 67.734 1593882 18115.223
Jamaica Americas 1982 71.210 2298309 6068.051
Algeria Africa 1967 51.407 12760499 3246.992
Case Studies: Building Web Applications with Shiny in R

Gapminder dataset

country continent year lifeExp pop gdpPercap
Netherlands Europe 2002 78.530 16122830 33724.758
Turkey Europe 1987 63.108 52881328 5089.044
Oman Asia 1987 67.734 1593882 18115.223
Jamaica Americas 1982 71.210 2298309 6068.051
Algeria Africa 1967 51.407 12760499 3246.992
Case Studies: Building Web Applications with Shiny in R

Gapminder dataset

country continent year lifeExp pop gdpPercap
Netherlands Europe 2002 78.530 16122830 33724.758
Turkey Europe 1987 63.108 52881328 5089.044
Oman Asia 1987 67.734 1593882 18115.223
Jamaica Americas 1982 71.210 2298309 6068.051
Algeria Africa 1967 51.407 12760499 3246.992
Case Studies: Building Web Applications with Shiny in R

Gapminder package

library(gapminder)

min(gapminder$pop)
60011
max(gapminder$pop)
1318683096
Case Studies: Building Web Applications with Shiny in R

Gapminder package

subset(gapminder, country == "Canada" & year < 1965)
    country continent year lifeExp      pop gdpPercap
241  Canada  Americas 1952   68.75 14785584  11367.16
242  Canada  Americas 1957   69.96 17010154  12489.95
243  Canada  Americas 1962   71.30 18985849  13462.49
subset(gapminder, country == "Canada" & year == 1962)$lifeExp
71.3
Case Studies: Building Web Applications with Shiny in R

Let's practice!

Case Studies: Building Web Applications with Shiny in R

Preparing Video For Download...