MINI MINI MANI MO
%
% Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
%
\name{ore.scriptCreate}
\alias{ore.scriptCreate}
\alias{ore.scriptList}
\alias{ore.scriptLoad}
\alias{ore.scriptDrop}
\title{
Oracle R Enterprise 嵌入式 R 脚本创建, 列表, 加载或删除函数
}
\description{
在 Oracle 数据库 \R 脚本资料档案库中创建
包含单个函数定义的 \R 脚本, 或者在
资料档案库中列出, 加载或删除 \R 脚本。
}
\usage{
ore.scriptCreate(name, FUN, global = FALSE, overwrite = FALSE)
ore.scriptList(name = NULL, pattern = NULL,
type = c("user", "global", "system", "all", "grant", "granted"))
ore.scriptLoad(name, owner = NULL, newname = NULL, envir = parent.frame())
ore.scriptDrop(name, global = FALSE, silent = FALSE)
}
\arguments{
\item{name}{
一个字符串, 用于指定 \R 脚本资料档案库中的
\R 脚本名称; 不能与参数 \code{pattern} 一起使用。
}
\item{FUN}{
一个函数定义, 将用于函数
\code{\link{ore.doEval}}, \code{\link{ore.groupApply}},
\code{\link{ore.indexApply}}, \code{\link{ore.rowApply}} 或
\code{\link{ore.tableApply}}。该函数无法递归调用
这些嵌入式 R API。
}
\item{pattern}{
一个用于指定匹配 \R 脚本名称的可选正则表达式
字符串; 不能与参数 \code{name} 一起使用。
}
\item{global}{
指示是创建还是删除全局 \R 脚本的可选
逻辑值。默认值为 \code{FALSE}, 这指示要创建或删除的
\R 脚本是私有脚本。每个用户对全局 \R 脚本
具有读取访问权限, 只有创建 \R 脚本的用户
才能访问或删除私有 \R 脚本。函数 \code{\link{ore.grant}}
和 \code{\link{ore.revoke}} 可用于将私有 \R 脚本的读取权限授予
其他用户或从其他用户上撤销。
}
\item{overwrite}{
一个用于指定是否覆盖指定 \R 脚本 (如果
已存在) 的逻辑值。
}
\item{type}{
指定要列出的 \R 脚本的类型的标量字符串。
有效值为 'user' (默认值), 'all', 'grant', 'granted' 或 'global'。
'user' 列出由当前会话用户创建的那些 \R 脚本。
'grant' 列出其读取权限已由当前会话用户授予
其他用户的 \R 脚本。
'granted' 列出其读取权限已由其他用户
授予当前会话用户的 \R 脚本。
'global' 列出用户创建的所有全局 \R 脚本。
'system' 列出系统预定义的所有 \R 脚本。
'all' 列出当前会话用户具有读取访问权限的所有 \R
脚本。
}
\item{owner}{
指定创建给定 \R 脚本的用户的
可选字符串。参数 \code{owner} 可以与参数
\code{name} 一起用于指定要将哪个 \R 脚本加载到 \R 环境中。
没有 \code{owner} 参数时, \code{\link{ore.scriptLoad}} 查找并按照以下顺序
加载与 \code{name} 匹配的 \R 脚本:
当前会话用户创建的 \R 脚本, 全局 \R 脚本。
}
\item{newname}{
一个可选字符串, 为当前会话中由 \code{\link{ore.scriptLoad}} 加载的
\R 函数指定新名称。
\code{newname} 值必须是有效的 R 函数名称。默认情况下,
\R 函数的名称使用脚本的名称。
}
\item{envir}{
一个可选 \R 环境变量, 指定包含
\code{\link{ore.scriptLoad}} 要将指定 \R 脚本加载到
其中的 \R 函数的环境。
}
\item{silent}{
一个可选逻辑值, 指示在删除指定
\R 脚本时, 如果 \code{\link{ore.scriptDrop}} 遇到错误
是否显示错误消息。
}
}
\details{
函数 \code{\link{ore.scriptCreate}}, \code{\link{ore.scriptDrop}} 需要
用户具有 \\option{RQADMIN} Oracle 数据库角色。
}
\value{
如果函数 \code{ore.scriptCreate}, \code{ore.scriptDrop} 和 \code{ore.scriptLoad}
成功创建, 删除或加载 \R 脚本, 则它们均返回一个
不可见的 \code{NULL} 值; 否则将生成错误。
函数 \code{ore.scriptList} 返回包含列 NAME 和 SCRIPT 的
数据框架, 以及可选列 OWNER 和 GRANTEE。
}
\references{
\href{http://www.oracle.com/technetwork/database/database-technologies/r/r-enterprise/documentation/index.html}{Oracle R Enterprise}
}
\author{
Oracle \email{oracle-r-enterprise@oracle.com}
}
\seealso{
\code{\link{ore.doEval}}
}
\examples{
if (!interactive())
{
# create an R script for the current user
ore.scriptCreate("MYLM",
function(data, formula, ...) lm(formula, data, ...))
IRIS <- ore.push(iris)
ore.tableApply(IRIS[1:4], FUN.NAME = "MYLM",
formula = Sepal.Length ~ .)
# create a global R script available to any user
ore.scriptCreate("GLBGLM",
function(data, formula, ...)
glm(formula=formula, data=data, ...),
global = TRUE)
ore.tableApply(IRIS[1:4], FUN.NAME = "GLBGLM",
formula = Sepal.Length ~ .)
# list R scripts
ore.scriptList()
ore.scriptList(pattern="LM", type="all")
# load an R script to an R function object
ore.scriptLoad(name="MYLM")
ore.scriptLoad(name="GLBGLM", newname="MYGLM")
MYLM(iris, formula = Sepal.Length ~ .)
MYGLM(iris, formula = Sepal.Length ~ .)
# grant and revoke R script read privilege to and from public
ore.grant(name = "MYLM", type = "rqscript")
ore.scriptList(type="grant")
ore.revoke(name = "MYLM", type = "rqscript")
ore.scriptList(type="grant")
# drop an R script
ore.scriptDrop("MYLM")
ore.scriptDrop("GLBGLM", global=TRUE)
ore.scriptList(type="all")
}
}
\keyword{programming}
\keyword{database}
\keyword{ORE}
OHA YOOOO