SQL Server 2016 with R Install

I installed the “SQL Server 2016 Release Candidate” today to start playing around with Microsoft is calling “SQL Server R Services (In-Database)”. I think this is really going to change the way we do things at the office and it’s got me really excited.

You can download the Release Candidate from https://www.microsoft.com/en-us/evalcenter/evaluate-sql-server-2016.

I chose the CAB install which downloads two files, about 1.9GB. Running the executable then unpacks the setup files you will need for installation. Then, setup should run automatically. Microsoft has some good instructions at https://msdn.microsoft.com/en-us/library/mt696069.aspx.

The last part of their instructions is a test to make sure R is working.


exec sp_execute_external_script @language =N'R',
@script=N'OutputDataSet<-InputDataSet',
@input_data_1 =N'select 1 as hello'
with result sets (([hello] int not null));
go

The install actually adds a new instance of R running on the server, which for me is just my laptop.  A simple change to the code above helped me to find where the instance is.


exec sp_execute_external_script @language =N'R',
@script=N'OutputDataSet <- as.data.frame(R.home())'
with result sets (([R.home] sysname));
go

You can add more packages to this install quite easily. I’ve gone ahead and pinned this R instance to my taskbar. Run it as an admin and the installed packages are automatically available to SQL Server code. After installing the actuar package, just to test, I ran this in SSMS and it worked!


exec sp_execute_external_script @language =N'R',
@script=N'
require(actuar)
OutputDataSet <- as.data.frame(search())'
with result sets (([LoadedPackages] sysname));
go

Advertisements

Author: adamleerich

An actuary in Hartford

5 thoughts on “SQL Server 2016 with R Install”

  1. having been doing R-in-database with Postgres and PL/R for the last 5 years in not-in-Hartford CT, it will interesting to compare the two approaches once the linux version of SS is released.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s