R Shiny + flexdashboard with code

Motivation

This demo app demonstrates how it is possible to combine the best of modern R ๐Ÿ“ฆ packages to create interactive web applications at zero cost and without HTML, CSS, or JavaScript knowledge.

The App: Google Trends Italy/US

Based on search term, the app takes data from google trends and shows results about Italy or US depending on the user selection.

These are the two main pages:

Dashboard

  • Trends over the time and forecasting
  • Interest by city (top ten)
  • Regional Interest

Download Forecast Data

Link

History Version

  1. Google trends Italy
  2. Added google trends US
  3. Added Download Forecast Data

R Packages

  • โœจ {Shiny} provides an elegant and powerful web framework for building web applications using R.

  • ๐Ÿ“Š {highcharter} is a rich R interface to the popular Highcharts JavaScript graphics library.

  • ๐Ÿ’ป {flexdashboard} helps construct flexible, attractive, interactive dashboards.

  • ๐Ÿ”ง {dplyr} contains a set of functions (or โ€œverbsโ€) that perform common data manipulation operations such as filtering for rows, selecting specific columns, re-ordering rows, adding new columns and summarizing data.

  • ๐Ÿ”ฎ {forecast} contains function for automatic forecasting determining an appropriate time series model, estimate the parameters and compute the forecasts.

  • ๐Ÿ“‘ {stringr} contains functions for manipulating strings in R.

  • ๐Ÿ“… {lubridate} facilitates working with dates and times.

  • ๐Ÿ“ˆ {gtrendsR} provides an interface for retrieving and displaying Google Trends information.

  • ๐Ÿ“ {DT} provides a R interface to the JavaScript library DataTables. R data objects (matrices or data frames) can be displayed as tables on HTML pages, and DataTables provides filtering, pagination, sorting, and many other features in the tables.

Numbers

  • ๐Ÿ“„ 1 file
  • ๐Ÿ•š 1 day of work (starting from tutorials of one of my courses)
  • โœ 200 lines of code
  • ๐Ÿšฟ 30 %>% pipe
  • ๐Ÿคน 100% fun

Reference