SQL Server 2016 with R Install

April 2, 2016

(This article was first published on TeachR, and kindly contributed to R-bloggers)

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',
@input_data_1 =N'select 1 as hello'
with result sets (([hello] int not null));

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));

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',
OutputDataSet <- as.data.frame(search())'
with result sets (([LoadedPackages] sysname));

To leave a comment for the author, please follow the link and comment on their blog: TeachR.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)