- 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.
- 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();
- In SSMS, use the following code to create an R Naive Bayes model and make predictions on a test ...