Skip to content

Architecture

Van Hal, Christina edited this page Dec 16, 2020 · 10 revisions

About R

R is an open source language and environment for statistical computing and graphics that provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, …) and graphical techniques, and is highly extensible.

One of R’s strengths is the ease with which well-designed visualizations and publication-quality plots can be produced, including mathematical symbols and formulae where needed. The Data INCITE program at Rensselaer Polytechnic Institute uses R as the basis for several courses, including Intro to Data Math, Data Analytics Research Lab and Health Analytics Challenge Lab; R also is the data analytics core of many research projects at Rensselaer.

R is available as Free Software under the terms of the Free Software Foundation’s GNU General Public License in source code form. It compiles and runs on a wide variety of UNIX platforms and similar systems (including FreeBSD and Linux), Windows and MacOS. For more information about R, refer to the R Project web site.

SafeCampus was developed using R version 3.6.0 (2019-04-26), running on CentOS 7.

About R Shiny

Shiny is an open source R package that provides an elegant and powerful web framework for building web applications using R. Shiny is a framework for turning analyses into interactive web applications without requiring extensive HTML, CSS, or JavaScript knowledge. Shiny does allow Shiny app developers to extend apps with CSS themes, htmlwidgets, and JavaScript actions, capabilities.

Note: "R" and "R Shiny" paragraphs were taken and edited from the MORTALITYMINDER Github wiki.

SafeCampus R Implementation

Data Availability

Data Sources were discussed on the page of the same name.

Data Prep Files

The data preparation was discussed on the Data Sources page.

R Shiny UI and Server

The R shiny package provides tag function that allows users to manipulate HTML objects in the code. So we can have CSS files and javascript files to style it just like normal web development. We have 6 pages in total that show different elements of our WAP Data. Users will see one page at a time and click to the next page with either the links or using our dropdown menu.

We choose to use Shiny largely because Shiny has built-in support for interactive plots generated by R. By choosing our options on the top navigation bar, users can see the related plots change to different times or dates (for example) according to the choice.

This is all done in R Shiny! Every Shiny App is consist of two parts: UI and server. The server part is where application logic lives. The server has two arguments input and output. Shiny uses reactive programming, so output will react to changes in input. We pass values that users can change, such as date or building, as input variables to server. Whenever the value of input variables change, anything that relies on the value is re-evaluated. When building or date is changed by the user, all the graphs that use the variable will rerender and all the text related will regenerate.

Note: Facts about the functionality of R Shiny were taken from the MM Github Wiki and R Shiny info pages.