R is NOT Just Another Statistical Program...

Ermias A
03 May, 2017

Statistics Estimation and Modelling Team, CDC-DGHT

Where is R today?

alt title

alt title

R Passes SAS in Scholarly Use!

(After removing SPSS)

It all starts here...

So..What can you do with R?

Dynamic visualization

R code

Mplot<-gvisMotionChart(UNAIDS2015Data,
        idvar="Country",timevar= "Year", 
        xvar = "New_inf",yvar = "Num_TB_HIV",
        sizevar = "HIV_size_variable",
        options = list( showChartButtons=TRUE))

What can you do with R?

Spatial vizualization (Maps)

R code

MozMap <- gvisMap(Sim_MozData, locationvar="latlong" ,tipvar ="TipV", 
                  options=list(showTip=TRUE, showLine=TRUE, enableScrollWheel=TRUE,
                               mapType='terrain', useMapTypeControl=TRUE))

What can you do with R?

Combining plots

R code

MapWd <- gvisGeoChart(UNAIDS2015Data, "Country", "HIV_prev_1549")

DataTable <- gvisTable(UNAIDS2015Data)

MapTable <- gvisMerge(DataTable, MapWd, horizontal=TRUE)

What can you do with R?

Tabular visualization (pivot table)

R code

library(rpivotTable)                        # pivot table

PvtTable<-rpivotTable(SimData)

What can you do with R?

Interactive web visualization (Shiny)

# Shiny is a package in RStudio to make easy to build interactive web applications

What can you do with R?

Creating documents for reporting and code sharing (R Markdown)

# creating webpages, PDF, MS Word files

# a  simple way of converting the output of an R script into html, Word, pdf or even into a slide presentation.