This collection of samples gets you started on R, R Tools for Visual Studio (RTVS), and Microsoft R Server:
- Download the samples zip file and extract to a folder of your choice.
examples/Examples.slnto see two folders in the project:
- A First Look at R gives a gentle introduction for newcomers to R.
- MRS and Machine Learning gives examples of how to use R and Microsoft R Server for machine learning.
A First Look at R
This sample provides an in-depth introduction to R through the extensive comments in two source files. For the best experience, place the cursor at the top of the file and press Ctrl+Enter to send the code line-by-lie to the R Interactive window. (Lines that install packages might take a minute or two to complete.)
1-Getting Started with R.Rcovers many R fundamentals including using packages, loading and analyzing data, and plotting.
2-Introduction to ggplot2.Rintroduces the ggplot2 graphic package known for its visually appealing plots and simple syntax. This example visualizes earthquake data from Fiji.
Microsoft R Server and Machine Learning
This collection of examples shows how to use R to create machine learning models and to take advantage of Microsoft R Server (MRS). Install MRS to run scripts with
MRS in the title and where noted.
As with all examples, open the file, place the cursor at the top, and then step through the code line by line with Ctrl+Enter. The markdown files in each folder also contain additional details.
Benchmarksruns a number of intensive, parallel linear algebra computations to show the performance gains that are possible through the use of Microsoft R Open and the Intel Math Kernel Library (MKL). With simulated data, the benchmarks specifically compare matrix calculations on one thread versus two.
Bike_Rental_Estimation_with_MRScreates a demand prediction model for bike rentals based on a historical data set, using Microsoft R Server.
Data_Explorationcontains three scripts:
Import Data from URL.Rshows how to load a URL-identified data file into R.
Import Data from URL to xdf.Rshows how to load a URL-identified data file into Microsoft R Server as an xdf. (Requires MRS.)
Using ggplot2.Ris an extension of the
A First Look at R/2-Introduction to ggplot2.Rsample, giving a more extensive tour of ggplot2's functionality including interactive 3D plotting.
.csvfiles used by other samples
Flight_Delays_Prediction_with_MRSshows how to predict flight delays using R, machine learning, and historical on-time performance and weather data.
Machine learningcontains three samples for learning to predict flight delays, housing prices, and bike rentals. Together, these samples demonstrate the application of R and MRS to real-world problems. They also show you how to use several popular machine learning models and deploy them as an Azure Web Service using an Azure Machine Learning workspace.
R_MRO_MRS_Comparisonis a six-part comparison that shows the similarities and differences of R, Microsoft R Open and Microsoft R Server with commands, syntax, constructs, and performance.
What's special about Microsoft R Open and Microsoft R Server?
Reproducible R Toolkit ensures that the libraries you used to build your R program are always available to others that want to reproduce your work.
Microsoft R Server is an extension of R that allows you to handle more data and handle it faster. It gives R two powerful capabilities:
Larger data sets without RAM limitations. MRS can process out-of-memory data from a variety of sources including Hadoop clusters, databases, and data warehouses.
Parallel, multi-core processing. MRS can efficiently distribute computation across all the computational resources it has available. On your personal workstation or a remote cluster, MRS gets an answer faster.
The following comparison shows that MRS and MRO with MKL have significantly better computation performance related to certain matrix calculation than R and MRO without MKL. Simulated data is used in this calculation:
For a technical comparison of R with MRO and MRS, check out Lixun Zhang's detailed discussion on the topic.
The following figure then compares elapsed time in seconds used in building Logistic Regression models to predict flight delays greater than 15 minutes. Elapsed time used in CRAN R increases dramatically when increasing a small number of rows, while MRS increases only by approximately two times. For details of this benchmark, check out the