How to do it...

  1. First, you need to enable external scripts in SQL Server. In SSMS, execute the following code:
-- Allow external scripts 
USE master; 
EXEC sp_configure 'show advanced options', 1; 
RECONFIGURE 
EXEC sp_configure 'external scripts enabled', 1;  
RECONFIGURE; 
GO 
For your convenience, the T-SQL code for this and the previous recipe is provided in the Chapter08.sql file.
  1. Then you need to install the e1071 package. You need to run as administrator R.exe the R Command Prompt from the C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\R_SERVICES\bin folder and execute the following commands:
install.packages("e1071"); 
q(); 
  1. In SSMS, use the following code to create an R Naive Bayes model and make predictions on a test ...

Get SQL Server 2017 Integration Services Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.