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 as shown in the screenshot below.

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")
      g=read.csv("GNP.csv",header=FALSE,skip=5,
                 stringsAsFactors=F)
      g=g[1:20,c(5,6)]
      names(g)=c("gnp","cont")
      g$gnp=from_currency(g$gnp)
      ggplot(g,aes(x=cont,y=gnp,fill=cont))+
           geom_boxplot(alpha=0.3)

plot of chunk gen

References

The source code can be found here:

URL of the application