1.4.2.1 About Oracle Machine Learning for R Data Types and Classes

OML4R has data types that map R data types to SQL data types.

In an R session, when you create database objects from R objects or you create R objects from database data, OML4R translates R data types to SQL data types and the reverse where possible.

OML4R creates objects that are instances of OML4R classes. OML4R overloads many standard R functions so that they use OML4R classes and data types. R language constructs and syntax are supported for objects that are mapped to Oracle Database objects.

Table 1-1 Mappings Between R, OML4R, and SQL Data Types

R Data Type OML4R Data Type SQL Data Type

character mode vector

ore.character

VARCHAR2

INTERVAL YEAR TO MONTH

integer mode vector

ore.integer

NUMBER

logical mode vector

ore.logical

The NUMBER 0 for FALSE and 1 for TRUE

numeric mode vector

ore.number

BINARY_DOUBLE

BINARY_FLOAT

FLOAT

NUMBER

Date

ore.date

DATE

POSIXct

POSIXlt

ore.datetime

TIMESTAMP

TIMESTAMP WITH TIME ZONE

TIMESTAMP WITH LOCAL TIME ZONE

difftime

ore.difftime

INTERVAL DAY TO SECOND

None

Not supported

LONG

LONG RAW

RAW

User defined data types

Reference data types

Note:

  • Objects of type ore.datetime do not support a time zone setting, instead they use the system time zone Sys.timezone if it is available or GMT if Sys.timezone is not available.

  • The SQL VARCHAR2 data type is mapped to the R character data type through the embedded R input data argument. Users can convert the character variable to a factor in R if needed by using as.factor().