2.2.2.1 About Ordering in ore.frame Objects

R objects such as vector and data.frame have an implicit ordering of their elements. The data in an Oracle Database table is not necessarily ordered. For some R operations, ordering is useful whereas for other operations it is unnecessary. By ordering an ore.frame, you are able to index the ore.frame object by using either integer or character indexes.

Using an ordered ore.frame object that is a proxy for a SQL query can be time-consuming for a large data set. Therefore, although Oracle R Enterprise attempts to create ordered ore.frame objects by default, it also provides the means of creating an unordered ore.frame object.

When you invoke the ore.sync function to create an Oracle R Enterprise ore.frame object as a proxy for a SQL query, you can use the use.keys argument to specify whether the ore.frame can be ordered or must be unordered.

An ore.frame object can be ordered if one or more of the following conditions are true:

  • The value of the use.keys argument of the ore.sync function is TRUE and a primary key is defined on the underlying table

  • The row names of the ore.frame constitute a unique tuple

  • The ore.frame object is produced by certain functions such as aggregate and cbind

  • All of the ore.frame objects that are input arguments to relevant Oracle R Enterprise functions are ordered

An ore.frame object is unordered if one or more of the following conditions are true:

  • The value of the use.keys argument of the ore.sync function is FALSE

  • No primary key is defined on the underlying table and either the row names of the ore.frame object are not specified or the row names of the ore.frame object are set to NULL

  • One or more of the ore.frame objects that are input arguments to relevant Oracle R Enterprise functions are unordered

An unordered ore.frame object has null row names. You can determine whether an ore.frame object is ordered by invoking is.null on the row names of the objects, as shown in the last lines of Example 2-13. If the ore.frame object is unordered, is.null returns an error.

See Also:

"Indexing Data"