GithubHelp home page GithubHelp logo

gapminder-app's Introduction

Gapminder-app

Shiny application for viewing Gapminder data.

Reflections

Debugging Shiny app issues was not easy, and very time consuming!

  • If anything, making my first Shiny app helped me to appreciate the awesomeness of built in testing when building an R package.

Adding a radioButtons widget to Shiny app, and using selection from radioButtons to filter (using dplyr) and plot (using ggplot) Gapminder data was MUCH harder than I expected!

  • This step was very painful and time consuming to debug. The choices within radioButtons are returned in quotes, and by default, dplyr and ggplot do not handle quoted variables. Thus the output of renderTable and renderPlot failed.
  • I tried many different ways to remove quotes from the variables, but this turned out to be difficult.
  • Solution part 1: I found this StackOverflow issue related to my problem. When I added matches(input$variable) to the reactive function, the downstream renderTable function works, but renderPlot didn't work.
  • Solution part 2: I also needed to use aes_string within the renderPlot ggplot call! Thanks to both Winston's post on Shiny google groups and Julia's help (see issue 1)

The reactive function is very confusing!

  • From the earliest stages of the Shiny app development, I obtained the error: "Error in eval(expr, envir, enclos) : object 'year' not found". I spent hours trying to debug this issue. It turns out I had to add another is.null argument for the year variable produced by the reactive function, but not in the way I expected...
  • Clue: adding the print statement str(two_country_data$year()) produced the following error: "Error in two_country_data$year : object of type 'closure' is not subsettable".
  • i.e. reactive objects are functions!!! Consequently, if you produce a dataframe using a reactive function, you do not access columns in the usual way. To access reactive object variable columns, I didn't realise you had to add open close brackets BEFORE the $ column name! i.e. two_country_data()$year (correct) is not the same as two_country_data$year() (incorrect).
  • Thanks again to Julia for helping me figure this out! (see issue 1)

Favourite moment during Shiny app development: no more red error messages popping up on the screen

  • I could then concentrate on making the user interface pretty :)

Future applications for Shiny?

  • Shiny + ggvis, full integration? It would be nice to hover your mouse over graphs in Shiny and see the values.
  • Aim to be as cool as the Google Public Data Explorer (which actually acquired Gapminder's Trendalyzer software!). The play button feature is pretty wicked.
  • Add Shiny apps to presentations, e.g. add it as a slide in Keynote/Powerpoint/other? That would be sweet!

gapminder-app's People

Contributors

rebjoh avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.