この例では、sys.rqScriptCreate
プロシージャを使用して、Oracle R EnterpriseのRスクリプト・リポジトリ内にスクリプトを作成します。
この例では、myRandomRedDots2
という名前のユーザー定義関数を作成します。このユーザー定義関数は2つの引数を受け入れ、2つの列を持ち指定の数のランダム標準値を表示するdata.frame
オブジェクトを返します。sys.rqScriptCreate
関数は、ユーザー定義関数をOracle R Enterpriseのスクリプト・リポジトリに格納します。
-- Create a script named myRandomRedDots2 and add it to the R script repository. -- Specify that the script is private and to overwrite a script with the same name. BEGIN sys.rqScriptCreate('myRandomRedDots2', 'function(divisor = 100, numDots = 100) { id <- 1:10 plot(1:numDots, rnorm(numDots), pch = 21, bg = "red", cex = 2 ) data.frame(id = id, val = id / divisor)}', v_global => FALSE, v_overwrite => TRUE); END; / -- Grant read privilege access to Scott. BEGIN rqGrant('myRandomRedDots2', 'rqscript', 'SCOTT'); END; / -- View the users granted read access to myRandomRedDots2. select * from USER_RQ_SCRIPT_PRIVS; NAME GRANTEE ---------------- ------- myRandomRedDots SCOTT -- Revoke the read privilege access from Scott. BEGIN rqRevoke('myRandomRedDots2', 'rqscript', 'SCOTT'); END; / -- Remove the script from the R script repository. BEGIN sys.rqScriptDrop('myRandomRedDots2'); END; /