MINI MINI MANI MO
%
% Copyright (c) 2012, 2015, 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 Embedded R Script Creation, List, Load, Drop
Functions}
\description{
Creates an \R script, which contains a single function definition, in
the Oracle Database \R script repository, or lists, loads, or drops
an \R script from the repository.
}
\usage{
ore.scriptCreate(name, FUN, global = FALSE, overwrite = FALSE)
ore.scriptList(name = NULL, pattern = NULL,
type = c("user", "global", "all", "grant", "granted"))
ore.scriptLoad(name, owner = NULL, newname = NULL, envir = parent.frame())
ore.scriptDrop(name, global = FALSE, silent = FALSE)
}
\arguments{
\item{name}{
A character string that specifies the name of an \R script in
the \R script repository; cannot be used with argument \code{pattern}.
}
\item{FUN}{
A function definition to be used with functions
\code{\link{ore.doEval}}, \code{\link{ore.groupApply}},
\code{\link{ore.indexApply}}, \code{\link{ore.rowApply}}, or
\code{\link{ore.tableApply}}. The function cannot recursively call
these embedded R APIs.
}
\item{pattern}{
An optional regular expression character string specifying the
matching \R script names; cannot be used with argument \code{name}.
}
\item{global}{
An optional logical value indicating whether to create or drop a global
\R script. The default value is \code{FALSE}, which indicates the
\R script to create or drop is a private script. Every user has read
access to a global \R script while only the user who created the \R script
can access and drop a private \R script. Functions \code{\link{ore.grant}}
and \code{\link{ore.revoke}} can be used to grant or revoke the read
privilege for a private \R script to other users.
}
\item{overwrite}{
A logical value specifying whether to overwrite the named \R script, if it
already exists.
}
\item{type}{
A scalar character string specifying the type of \R script to list.
The valid value is 'user' (default), 'all', 'grant', 'granted', or 'global'.
'user' lists these \R scripts created by current session user.
'grant' lists \R scripts the read privilege for which has been granted
by the current session user to other users.
'granted' lists \R scripts the read privilege for which has been granted
by other users to the current session user.
'global' lists all global \R scripts.
'all' lists all \R scripts to which the current session user has read
access.
}
\item{owner}{
An optional character string specifying the user who created the named
\R script. Argument \code{owner} can be used along with argument
\code{name} to specify which \R script to load into an \R environment.
Without the \code{owner} argument, \code{\link{ore.scriptLoad}} finds and
loads the \R script that matches \code{name} in the following order:
\R script that the current session user created, global \R script.
}
\item{newname}{
An optional character string specifying a new name in the current session
for the \R function that is loaded by \code{\link{ore.scriptLoad}}.
The \code{newname} value must be a valid R function name. By default,
the name of the \R function takes the name of the script.
}
\item{envir}{
An optional \R environment variable that specifies the environment that
contains the \R function into which \code{\link{ore.scriptLoad}} loads
the named \R script.
}
\item{silent}{
An optional logical value indicating whether to display an error message
when \code{\link{ore.scriptDrop}} encounters an error in dropping the
named \R script.
}
}
\details{
Functions \code{\link{ore.scriptCreate}}, \code{\link{ore.scriptDrop}}
require the user to have the \option{RQADMIN} Oracle Database role.
}
\value{
Functions \code{ore.scriptCreate}, \code{ore.scriptDrop}, and
\code{ore.scriptLoad} return an invisible \code{NULL} value if they succeed
in creating, dropping, or loading an \R script; otherwise they produce
an error. Function \code{ore.scriptList} returns a data frame that contains
the columns NAME and SCRIPT, and optionally the columns OWNER and 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