SQL Server R language tutorials

APPLIES TO: yesSQL Server noAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

This article describes the R language tutorials for in-database analytics on SQL Server 2016 R Services or SQL Server Machine Learning Services.

  • Learn how to wrap and run R code in stored procedures.
  • Serialize and save r-based models to SQL Server databases.
  • Learn about remote and local compute contexts, and when to use them.
  • Explore the Microsoft R libraries for data science and machine learning tasks.

R quickstarts and tutorials

Link Description
Quickstart: Using R in T-SQL First of several quickstarts, with this one illustrating the basic syntax for calling an R function using a T-SQL query editor such as SQL Server Management Studio.
Tutorial: Learn in-database R analytics for data scientists For R developers new to SQL Server, this tutorial explains how to perfrom common data science tasks in SQL Server. Load and visualize data, train and save a model to SQL Server, and use the model for predictive analytics.
Tutorial: Learn in-database R analytics for SQL developers Build and deploy a complete R solution, using only Transact-SQL tools. Focuses on moving a solution into production. You'll learn how to wrap R code in a stored procedure, save an R model to a SQL Server database, and make parameterized calls to the R model for prediction.
Tutorial: RevoScalepR deep dive Learn how to use the functions in the RevoScaleR packages. Move data between R and SQL Server, and switch compute contexts to suit a particular task. Create models and plots, and move them between your development environment and the database server.

Code samples

Link Description
Build a predictive model using R and SQL Server Learn how a ski rental business might use machine learning to predict future rentals, which helps the business plan and staff to meet future demand.
Perform customer clustering using R and SQL Server Use unsupervised learning to segment customers based on sales data.

See also