09.09.2016 Views

SAP HANA R Integration Guide

2c9H5is

2c9H5is

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.3 Calling an R Function<br />

This topic demonstrates how the support vector machine classification can be embedded in the <strong>SAP</strong> <strong>HANA</strong><br />

database.<br />

In the <strong>SAP</strong> <strong>HANA</strong> studio, execute the following SQL statements, for example, in the SQL Console for your <strong>SAP</strong><br />

<strong>HANA</strong> system. The code defines and calls an embedded R procedure.<br />

DROP TABLE "spamClassified";<br />

CREATE COLUMN TABLE "spamClassified" LIKE "spamEval" WITH NO DATA;<br />

ALTER TABLE "spamClassified" ADD ("classified" VARCHAR(5000));<br />

DROP PROCEDURE USE_SVM;<br />

CREATE PROCEDURE USE_SVM(IN train "spamTraining", IN eval "spamEval",<br />

OUT result "spamClassified")<br />

LANGUAGE RLANG AS<br />

BEGIN<br />

library(kernlab)<br />

model

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!