Friday 29 January 2016

The R User Conference 2016: June 27 - June 30, 2016 Stanford University, Stanford, California

Registration and abstract submission is ongoing.

The annual useR! conference is the main meeting of the international R user and developer community. Its program consists of both invited and user-contributed presentations.
  • The invited keynote lectures cover a broad spectrum of topics ranging from technical and R-related computing issues to general statistical topics of current interest.
  • The user-contributed presentations and posters are submitted as abstracts prior to the conference and may be related to (virtually) any R-related topic. The presentations are typically organized in sessions of either broad or special interest, which also comprise a "free" discussion format. Such a discussion format not only provides a forum for software demonstrations and detailed discussions but also supports the self-organization of the respective communities. The duration is between 15 or 20 minutes for the focus and kaleidoscope sessions, and 5 minutes for lightning talks.
This year the conference will be held at the campus of Stanford University in Stanford, CA. The conference is being organized with support from the Department of Statistics, Stanford University and the Stanford Libraries.
The program will cover topics such as
  • History of R and computing with data
  • Bayesian Statistics
  • Bioinformatics
  • Economics, Finance and Insurance
  • High Performance Computing
  • Reproducible Research
  • Industrial Applications
  • Statistical Learning with Big Data
  • Spatial Statistics
  • Teaching
  • Visualization & Graphics
  • and many more.
The year 2016 will be special in at least two ways: it marks the 40th anniversary of the S language (the language underlying R), and is also the year that John Chambers, an inventor of S, turns 75. Holding the conference at Stanford, the epicenter of Silicon Valley, is especially timely given the prominent position of R in the rapidly expanding fields of big data and data science.
Posted by Thilina Thilakarathna

Saturday 23 January 2016

Stochastic Processes and Monte Carlo with R

The use of probability and statistics is ubiquitous in quantitative finance. All of the observable prices, volumes, order arrival rates, etc, are due to supply and demand imbalances. However, keeping track of all the supply and demand imbalances becomes cumbersome as the number of variables increases. Statistical tools are vital in explaining and modeling these effects. Stochastic processes and Monte Carlo analysis are some of the tools that are used in the fields of finance, economics and marketing.

http://www.rfortraders.com/lecture-6-stochastic-processes-and-monte-carlo/

Posted by  Prabhani Jayasinghe

Friday 22 January 2016

GUI Programming Using R

Good news for R Users.
GUI programming now available with R!


A few days back the RStudio blog announced Shiny, a new product for easily creating interactive web applications (http://www.rstudio.com/shiny/). I wanted to compare this new framework to one I’ve worked on, gWidgetsWWW2.rapache – a version of the gWidgets API for use with Jeffrey Horner’s rapache module for the Apache web server (available at GitHub). The gWidgets API has a similar aim to make it easy for R users to create interactive applications.
I don’t want to worry here about deployment of apps, just the writing side. The shiny package uses websockets to transfer data back and forth from browser to server. Though this may cause issues with wider deployment, the industrious RStudio folks have a hosting program in beta for internet-wide deployment. For local deployment, no problems as far as I know – as long as you avoid older versions of internet explorer.
Now, Shiny seems well suited for applications where the user can parameterize a resulting graphic, so that was the point of comparison. Peter Dalgaard’s tcltk package ships with a classic demo tkdensity.R. I use that for inspiration below. That GUI allows the user a few selections to modify a density plot of a random sample.

gWidgetsWWW2

We’ll start with a gWidgets approach and work our way to the shiny code. A basic GUI can be generated with the following code:
 
width <- 600; height <- 480
 
## The plot commands. Uses GUI objects defined below
make_plot <- function(...) {
  y <- get(svalue(distribution))(svalue(size))
  plot(density(y, bw=svalue(bandwidth)/100, kernel=svalue(kernel)))
  points(y, rep(0, svalue(size) ))
}
 
update_plot <- function(...) {
  f <- tempfile()
  require(canvas)
  canvas(f, width=width, height=height)
  make_plot()
  dev.off()
  svalue(cnv) <- f ## update canvas widget
}
 
## The layout
w <- gwindow("tkdensity example")
gstatusbar("Powered by gWidgetsWWW2.rapache and rapache", cont=w)
 
## containers
bl <- gborderlayout(cont=w)
fl <- gformlayout(cont=bl, where="west")
 
## controls
distribution <- gcombobox(data.frame(value=c("rnorm", "rexp"),
                                     labels=c("Normal", "Exponential"),
                                     stringsAsFactors=FALSE),
                          cont=fl, label="distribution")
kernel <- gcombobox(c("gaussian", "epanechnikov", "rectangular",
             "triangular", "cosine"),
                    cont=fl, label="kernel")
size <- gcombobox(c(5,50, 100, 200, 300),
                  coerce.with="as.numeric",
                  cont=fl, label="size")
bandwidth <- gslider(0.05*100, 2*100, by=0.05*100, value=1*100,
                     width=250,
                     coerce.with="as.numeric",
                     cont=fl, label="bandwidth")
refresh <- gbutton("refresh",
                   cont=fl, label="")
 
cnv <- gcanvas(cont=bl, where="center", width=width, height=height)
 
## connect controls
for(i in list(kernel, size, bandwidth, refresh))
  addHandlerChanged(i, update_plot)
All right, that may look like a lot, but lots of people have used gWidgets to write such GUIs. They aren’t that hard. basically there are three parts:
  • The definition of the controls and their layout that comprise the
    user interface.
  • The definition of some callback to create the graphic when a control
    is updated.
  • Some means to specify when to invoke this call back.
The gWidgets API is meant to be cross-toolkit, but this is only mostly true. In the above we use a few web-specific features, including the canvas package to provide a JavaScript canvas for drawing R graphics.

Manipulate

This particular example would be really easy were we able to use RStudio’s manipulate package. That is only for RStudio users though. Well, not really. There is a simple map available in thegWidgetsWWW2.rapache package that allows us to easily use that specification. Here is the code:
 
## load in map for manipulate -> gWidgets
source(system.file("demo", "manipulate.R", package="gWidgetsWWW2.rapache"), local=TRUE)
 
w <- gwindow("Manipulate example")
gstatusbar("Powered by gWidgetsWWW2.rapache and rapache", cont=w)
 
manipulate(
           {
             y <- get(distribution)(size)
             plot(density(y, bw=bandwidth/100, kernel=kernel))
             points(y, rep(0, size))
           },
           ##
           distribution=picker("Normal"="rnorm", "Exponential"="rexp"),
           kernel=picker("gaussian", "epanechnikov", "rectangular",
             "triangular", "cosine"),
           size=picker(5, 50, 100, 200, 300),
           bandwidth=slider(0.05 * 100, 2.00 * 100, step=0.05 * 100, initial=1* 100), # integers needed
           button=button("Refresh"),
           ## gWidgetsWWW2.rapache extras
           container=w,
           device="svg",                # svg or canvas or png
           delay=1000                   # delay to let data load for combo boxes
           )
Okay, I admit. I’m a fan of manipulate and it really is a perfect way to specify an interface as straightforward as this. This one is an example in the gWidgetsWWW2.rapache package and you can see it in action at http://www.math.csi.cuny.edu/gw/ex-manipulate.R (though this redirects to a private server which is often not online). The manipulateinterface handles the layout of the controls and the invocation of the callback, all you add is an expression to plot and a specification of
the controls.

Shiny

Now for Shiny. We noted above there are really three pieces to writing this app, with Shiny we only need to worry about two: the definition and layout of the user interface, and the specification of how the resulting graphic is made. For this, we write two functions: ui.R and server.R.
The ui.R files is used to layout the interface. Here is ours:
library(shiny)
 
shinyUI(pageWithSidebar(
 
  # Application title
  headerPanel("tkdensity"),
 
  # Sidebar with a slider input for number of observations
  sidebarPanel(
               selectInput("distribution", "Distribution:",
                           choices = c("Normal"="rnorm", "Exponential"="rexp")),
               selectInput("kernel", "Kernel:",
                           choices = c("gaussian", "epanechnikov", "rectangular",
                             "triangular", "cosine")),
               selectInput("size", "Size:",
                           choices = c(5,50, 100, 200, 300)),
               sliderInput("bandwidth", "bandwidth:",
                           min = 0.05,
                           max = 2,
                           value = 1)
  ),
 
  # Show a plot of the generated distribution
  mainPanel(
    plotOutput("distPlot")
  )
))
There are a few containers (“panels”) and a few controls specified (“inputs”). The basic usage of shiny involves just a handful of each and they are easy to learn. The above code simply makes a header, puts four controls into a side panel and in the main panel readies a place to display our plots. The name distPlot is odd because I stole this basic set up from one of shiny‘s examples and made just minor changes.
The server.R file is not difficult either. We need to make the graphic so that it displays. Here it is:
library(shiny)
 
shinyServer(function(input, output) {
 
  make_plot <- function(distribution, size, bandwidth, kernel) {
    y <- get(distribution)(size)
    plot(density(y, bw=bandwidth, kernel=kernel))
    points(y, rep(0, size))
  }
 
  output$distPlot <- reactivePlot(function() {
    make_plot(input$distribution, input$size, input$bandwidth, input$kernel)
  })
})
Again, this is only slightly modified from an example. The input object is not a list or an environment, but we can extract the values associated with the user interface as though it were. In the above we see the distributionsizebandwidth and kernel values are passed along to the make_plot call. The only new thing here, besides that, is the magic way we create a plot (passing a function as a call back to reactivePlot and assigning it to distPlot in the output object). The shiny package takes care of the third part of our GUI, using this “reactive” programming style to synchronize various parts of
the interface.
Want to see it at work? Well fire up your copy of shiny and run it from a GitHub gist:
require(shiny)
shiny:::runGist("4009017")
Before you gloss over the above lines, think how neat this is. Just as you can install packages from GitHub within an R session through the devtools package, you can run shiny apps within R from GitHub with the runGist function. This is an awesome feature for deploying interactive web apps for local usage.
I think you’ll see, if you compare, for this task the user experience is nicer with shiny than that of gWidgetsWWW2.rapache. The specification of the GUI is easiest with the manipulate style, but using shiny wasn’t difficult. I personally like very much the use of the “bootstrap” CSS libraries (http://twitter.github.com/bootstrap/), as opposed to the ExtJS CSS (http://www.sencha.com/products/extjs/). The interface looks very modern. (Not only looks, the slider is much better than that ingWidgetsWWW2.rapache, where the underlying control only wants integer values.) Though the gWidgetsWWW2.rapache package might have more controls and more layout options than the basic use of shiny, I can see that there will be a huge number of great shiny apps written. Within its range of use, it is a great choice for easily making R-driven web applications.

 
To Read this :
 
Posted by Thiloka Bogahalanda 
 

Thursday 21 January 2016

Time Series and Forecasting

R has extensive facilities for analyzing time series data. This describes the creation of a time series, seasonal decomposition, modeling with exponential and ARIMA models, and forecasting with the forecast package.

http://www.statmethods.net/advstats/timeseries.html

Posted by Irosha De Silva

Wednesday 20 January 2016

How to plot a graph in R


R has an awesomely powerful function called plot(), which will try to cleverly produce an appropriate plot depending on the type of data.  See the following link.

https://wiki.mobilizingcs.org/rstudio/plots


Posted by Sathees kumar 

Monday 18 January 2016

R 3D Plots

There are many functions in R programming language for creating 3D plots. In this section we will discuss on the persp() function which can be used to create 3D surfaces in perspective view.

http://www.programiz.com/r-programming/3d-plot

Posted by Monika Warnasooriya

Sunday 17 January 2016

Resources to help you learn and use R

  1. IDRE UCLA Statistical Computing  it’s a website full of annotated examples of standard analyses in R

  2. A Compendium of Clean Graphs in R, this is a guide to Produce clean graphs in R.

  3. The codeschool A place to learn R for people who have zero R experience.

  4. Coursera  (R Programing) A course to learn how to program in R and how to use R for effective data analysis.

 

Posted by Anjana Yatawara

 


Friday 15 January 2016

Why now is the time to learn R

Here are just a few examples:
  • Google uses R to calculate the ROI on advertising campaigns.
  • Ford uses R to improve the design of its vehicles.
  • Twitter uses R to monitor user experience.
  • The US National Weather Service uses R to predict severe flooding.
  • The Rockefeller Institute of Government uses R to develop models for simulating the finances of public pension funds.
  • The Human Rights Data Analysis Group uses R to quantify the impact of war.
  • R is used frequently by The New York Times to create infographics and interactive data journalism applications.
Check this out!
https://opensource.com/business/14/12/r-open-source-language-data-science

Posted by  Rajitha Thiyagarajah

R Programming @ Johns Hopkins University

In this course you will learn how to program in R and how to use R for effective data analysis. You will learn how to install and configure software necessary for a statistical programming environment and describe generic programming language concepts as they are implemented in a high-level statistical language. The course covers practical issues in statistical computing which includes programming in R, reading data into R, accessing R packages, writing R functions, debugging, profiling R code, and organizing and commenting R code. Topics in statistical data analysis will provide working examples.
 
 
Posted by Sajeththa Thavayogarajah

Tuesday 12 January 2016

Time Series Analysis and Mining with R

Contents
  1. Time series data in R
  2. Time series decomposition, forecasting, clustering and classification
  3. Autoregressive integrated moving average (ARIMA) model
  4. Dynamic Time Warping (DTW)
  5. Discrete Wavelet Transform (DWT)
  6. k-NN classification

http://www.rdatamining.com/docs/time-series-analysis-and-mining-with-r


Posted by  Mudushini Liyanage

Linear Models in R: Plotting Regression Lines

Check this link!

http://www.theanalysisfactor.com/linear-models-r-plotting-regression-lines/

Posted by Sajeththa Thavayogarajah

Plotly R Library 2.0

Plotly for R is an interactive, browser-based charting library built on the open source JavaScript graphing library, plotly.js. It works entirely locally, through the HTML widgets framework.

  https://plot.ly/r/

Posted by Manusha Lakmali