2.2.5.1 About Persisting Oracle R Enterprise Objects

With Oracle R Enterprise datastores, you can save R objects in the database.

R objects, including Oracle R Enterprise proxy objects, exist for the duration of the current R session unless you explicitly save them. The standard R functions for saving and restoring R objects, save and load, serialize objects in R memory to store them in a file and deserialize them to restore them in memory. However, for Oracle R Enterprise proxy objects, those functions do not save the database objects associated with the proxy objects in an Oracle database; therefore the saved proxy objects do not behave properly in a different R session.

You can save Oracle R Enterprise proxy objects, as well as any R object, with the ore.save function. The ore.save function specifies an Oracle R Enterprise datastore. A datastore persists in the database when you end the R session. The datastore maintains the referential integrity of the objects it contains. Using the ore.load function, you can restore in another R session the objects in the datastore.

Using a datastore, you can do the following:

  • Save Oracle R Enterprise and other R objects that you create in one R session and restore them in another R session.

  • Pass arguments to R functions for use in embedded R execution.

  • Pass objects for use in embedded R execution. You could, for example, use a function in the OREdm package to build an Oracle Data Mining model and save it in a datastore. You could then use that model to score data in the database through embedded R execution. For an example of using a datastore in an embedded R execution function, see Example 6-10.

Table 2-1 lists the functions that manipulate datastores and provides brief descriptions of them.

Table 2-1 Functions that Manipulate Datastores

Function Description

ore.datastore

Lists information about a datastore in the current Oracle database schema.

ore.datastoreSummary

Provides detailed information about the specified datastore in the current Oracle database schema.

ore.delete

Deletes a datastore from the current Oracle database schema.

ore.grant Grants read access to a datastore.

ore.lazyLoad

Lazily restores objects from a datastore into an R environment.

ore.load

Restores objects from a datastore into an R environment.

ore.revoke Revokes read access to a datastore.

ore.save

Saves R objects in a new or existing datastore.

See Also:

"Using Oracle R Enterprise Embedded R Execution" for information on using the R and the SQL interfaces to embedded R execution