A.4 Verifying the Oracle Machine Learning for R Installation
To verify that the basic functionality of OML4R is working, establish a connection to an OML4R server and execute several basic functions.
Note:
To start and use OML4R, your database user must have the privileges required for OML4R installation. See User Requirements for details.
Example A-2 Connecting to an OML4R Server
To connect the an OML4R client to an OML4R server:
- 
                        
                        Select R x64 3.3.0 from the Windows Start menu. The R Console is displayed. 
- 
                        
                        Type this command to start OML4R: $ ORE R> library(ORE) 
- 
                        
                        Type this command to connect to the OML4R server. The following example connects user OML_USERto the databaseorclon the server hostserv1using port 1521:> ore.connect(user="OML_USER", sid="orcl", host="serv1", password="OML_USERpsw", port=1521, all=TRUE) Loading required package: ROracle Loading required package: DBI
- 
                        
                        Execute ore.is.connectedto validate the connection. If the connection is successful, the function returnsTRUE:> ore.is.connected() [1] TRUE 
Example A-3 Listing the Database Tables Accessible in a Schema
The ore.ls function
                                                  lists the ore.frame proxy objects
                                                  that correspond to database tables in the
                                                  environment for a schema. In the following
                                                  example, TABLE1 and
                                                  TABLE2 exist in the current
                                                  schema:
                  
> ore.ls() [1] "TABLE1" "TABLE2"
Example A-4 Pushing an R Data Frame to the Database
The ore.push function
                                                  pushes a local R object into an OML4R object of the appropriate data type in
                                                  the database. The following example creates an R
                                                  data.frame and pushes it an
                                                  ore.frame object in the
                                                  database.
                  
df <- data.frame(a="abc",
                 b=1.456,
                 c=TRUE,
                 d=as.integer(1))
of <- ore.push(df)Example A-5 Executing an Embedded R Function
The ore.doEval function
                                                  executes the specified function in an R engine on
                                                  the database server and returns the results. This
                                                  example declares a function in the
                                                  ore.doEval invocation.
                  
> ore.doEval(function() { 123 })
[1] 123
                  Parent topic: A Sample Installation of Oracle Machine Learning for R