R / RStudio / Shiny



Analyse your data using the R language and RStudio. The RStudio IDE is a powerful and productive user interface for R. It’s free and open source, and works great on Windows, Mac, and Linux.

Shiny is an elegant and powerful web framework for building interactive reports and visualizations using R — with or without web development skills.


The 'R' Language

R is a language and environment for statistical computing and graphics. It is a GNU project which is similar to the S language and environment which was developed at Bell Laboratories (formerly AT&T, now Lucent Technologies) by John Chambers and colleagues. R can be considered as a different implementation of S. There are some important differences, but much code written for S runs unaltered under R.

R 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. The S language is often the vehicle of choice for research in statistical methodology, and R provides an Open Source route to participation in that activity.

One of R’s strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed. Great care has been taken over the defaults for the minor design choices in graphics, but the user retains full control.

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.

From - http://www.r-project.org/about.html

RStudio

RStudio is an integrated development environment (IDE) for R. It includes a console, syntax-highlighting editor that supports direct code execution, as well as tools for plotting, history, debugging and workspace management. Shiny allows you to easily publish your visualisations to the web.

R Notes

Tidyverse

The tidyverse is an opinionated collection of R packages designed for data science. All packages share an underlying philosophy and common APIs. The packages include :-


Package Description
ggplot2ggplot2 is a system for declaratively creating graphics, based on The Grammar of Graphics. You provide the data, tell ggplot2 how to map variables to aesthetics, what graphical primitives to use, and it takes care of the details. For more info go here
dplyrdplyr is a grammar of data manipulation, providing a consistent set of verbs that help you solve the most common data manipulation challenges. For more info go here
tidyrThe goal of tidyr is to help you create tidy data. For more info go here
readrThe goal of readr is to provide a fast and friendly way to read rectangular data (like csv, tsv, and fwf). It is designed to flexibly parse many types of data found in the wild, while still cleanly failing when data unexpectedly changes. For more info go here
purrrpurrr enhances R’s functional programming (FP) toolkit by providing a complete and consistent set of tools for working with functions and vectors. For more info go here
tibbleA tibble, or tbl_df, is a modern reimagining of the data.frame, keeping what time has proven to be effective, and throwing out what is not. For more info go here

For more info go to tidyverse.org. Install the packages into RStudio using the following :- install.packages("tidyverse")


There is great intro on the Rstudio website from Hadley Wickham from rstudio.conf 2017 :- here

Processing Midata

midata is a UK government-promoted initiative. It allows individuals to download transaction data in a standard midata file format. The intention of the midata initiative is to help consumers compare different products - current accounts / utility suppliers etc.


The following are some notes on how to import midata files into R and how they can be processed to make suitable financial decisions.


Time Series

Creating an xts time-series object - daily interval


Creating an xts time-series object - weekly interval


Plot - Dygraph

Plot daily income data



Plot weekly income data



Links

The R Cookbook - solutions to common tasks and problems in analyzing data.

Advanced R - a free online book by Hadley Wickham (or buy it from CRC Press).