Software Development in R Programming Language

Stephen Bique, Ph.D., Computer Scientist

  • What is R?
  • What is RStudio and why use it?
  • Background on the Web app
  • Making reports and slide decks
  • Look at the Shiny web app
  • See how the Shiny web App works on phones

What is R and its history?

  • Functional language with a very simple syntax
    • Familiar and easy C-like language
  • R is a statistical analysis system created by Ross Ihaka & Robert Gentleman
    • Most widely used statistics software in the world
  • R is considered to be a dialect of the language S created by the AT& T Bell Lab-oratories
  • S is available as the software S-PLUS commercialized by MathSoft
  • R is freely distributed from the Comprehensive R Archive Network (CRAN)
  • R was designed to use only a single thread (processor) at a time

R Summary

  • R is open-source, free, and runs on all platforms
  • R has precisely the tools and support needed to do data science on Big Data
  • A simple and effective programming language and environment for statistical computing and graphics with all needed input and output facilities and the usual
    • conditionals, loops, user-defined recursive functions
    • facilities for efficient data manipulation, storage, calculation, and graphical display
    • suite of operators and tools to operate on
      • lists, arrays, tables and 'data.frames'
      • data.frame is part of 'base' R (data.table is a package) and the most common data structure for data analyses

Example of R code in R Markdown Document

R code showing operations on data.frames

What is R Open?

  • Microsoft R Open is the enhanced distribution of R from Microsoft Corporation
  • current release is Microsoft R Open 4.0.2
  • Compatibility with all packages, scripts and applications that work with R-4.0.2
  • Support for Windows and Linux-based platforms
  • Multi-threaded math libraries that brings multi-threaded computations to R
  • Works well with doParallel package: dispatch tasks to different cores ('foreach/dopar')
  • A high-performance default CRAN repository and checkpoint package that make it easy to retrieve the exact versions of a packages
  • Microsoft R Open 4.0.2 is open source and free

What is RStudio?

  • An integrated development environment (IDE) for R and R Open
  • Available in open source and commercial editions/versions
  • Includes a console, syntax-highlighting editor that supports
    • direct code execution
    • tools for plotting, history, debugging, workspace management
    • tutorials
  • Makes it easy to find and install packages (CRAN)
  • Supports documented code in a 'python-like' notebooks aka 'R Markdown'

Why use RStudio?

  • R has found numerous applications in predictive analytics and machine learning
  • R is popular with a large collection of packages available for data science
  • Makes documented code sort of de facto standard
  • Tight integration with the popular 'git' (version control) which makes sharing 'notebooks' practical
    • easy to 'Fork' someone's directory from GitHub and to share your work on GitHub
  • Create 'R Presentation' which allows documentation, code, graphics and even supports bibliographic references
  • Create a slide deck that looks professional
  • Create a 'Shiny' web app which is an interactive application without having to learn CSS and javascript

Example of R Markdown Document

R Markdown example showing sections

View Report on RPubs - Easy web publishing from R

Example Showing Support for Bibliographies in R Markdown Document

R Markdown showing bibliographic entries

Example Showing Creation of Slide Deck (R Presentation) in RStudio

R Presentation

View Slide Deck on RPubs

Quick View of GUI Development for Shiny Web App in RStudio

GUI Development of Shiny Web App in RStudio

What the Shiny App Looks Like on a Windows Desktop

Shiny Web App on Windows Desktop

Run the Shiny Web App on Shiny Server

Shiny server is designed to host Shiny apps Link to Chat Assistant App

Test Performance of Slide Deck on RPubs

Test Performance of Shiny Web App on Mobile Devices

Test App on Mobile Devices Using Emulators

References