Shiny GNP Application

Jose Rios
May 31, 2018

Introduction

This presentation is part of the Peer-graded Assignment of Coursera's Developing Data Products course (https://www.coursera.org/learn/data-products/p). The students are asked to document an application written in R's Shiny package.

The user is required to provide the number of countries (n) and the application will generate a boxplot with the n countries with the highest GNP as of 2012. The plot is grouped by continent.

Screenshot

This is a screenshot of the applicatio running on the server.

GNP Shiny application

How to Run

To use the application, it suffices to visit this website, https://riverlebon.shinyapps.io/project-shiny/, and provide the number of countries.

Codes

The following code is used for each continent:

  • AF - Africa
  • AS - Asia
  • EU - Europe
  • ME - Middle East
  • NO - North America
  • OC - Oceania
  • SA - South America

Example for 20 countries

      library("ggplot2")
      library("lucr")
      N=20
      g=read.csv("GNP.csv",header=FALSE,skip=5,dec=".",stringsAsFactors=F)
      g=g[1:N,c(1,5,6)]
      names(g)=c("ccode","gnp","continent")
      g$gnp=from_currency(g$gnp)
      ggplot(g,aes(x=continent,y=gnp,fill=continent))+
           geom_boxplot(alpha=0.3)

plot of chunk gen

References

The source code can be found here:

URL of the application