LoadDataFrameFromTable Method

Loads a table into the R interpreter's global workspace as a data frame.

Class:R
Intended use:Recommended for external callers
COM:Not exposed by a COM class
ArcGIS:Not exposed as an ArcGIS geoprocessing tool
Method type:Classmethod

Usage

R.LoadDataFrameFromTable(connection, table, dataFrameName, fields[, stringsAsFactors[, timeZone[, where[, orderBy[, directions]]]]])

Arguments

connection
Python type:GeoEco.DatabaseAccess.DatabaseConnection

DatabaseConnection instance containing the table to load.

table
Python type:unicode
Minimum length:1

Table to load.

dataFrameName
Python type:unicode
Minimum length:1

Name of the data frame to create. The data frame will be created as a global variable in the single instance of the R interpreter that exists for the lifetime of the Python interpreter.

fields
Python type:list of unicode
Minimum length:1

List of fields to load. You must specify at least one field.

stringsAsFactors
Python type:bool
Default value:True

If True (the default), all table columns that contain strings will be automatically converted to R factors when the tables are loaded as data frames. Factors are suitable when the column contains values from a finite list of codes (i.e., it is a categorical variable). Many of R's analysis functions can operate on factors but not regular character vector columns.

If False, all table columns that contain strings will be converted to regular character vector columns.

timeZone
Python type:unicode or None
Default value:None
Minimum length:1

Time zone of dates. If you do not specify a time zone, the current local time zone reported by the operating system will be used.

The time zone is an operating-system-specific string in the format required by the R strptime function, such as "GMT" for Greenwich Mean Time (a.k.a. UTC, or Coordinated Universal Time). R provides the following documentation about this format:

"Where OSes describe their valid timezones can be obscure. The help for tzset (or _tzset on Windows) can be helpful, but it can also be inaccurate. There is a cumbersome POSIX specification, (listed under environment variable TZ at http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html), which is often at least partially supported, but there may be other more user-friendly ways to specify timezones. Windows documents a specification of the form GST-1GDT, but seems always to apply the US rules for changing to/from DST with such a specification. (There appears to be no documented way to apply timezones using other DST rules except to switch to the timezone, e.g. from the Control Panel.) So valid time zone values are of the forms EST5EDT for a timezone 5 hours west of GMT called EST when daylight saving is in force and EDT when it is not, HST10 for 'Hawaii-Aleutian Standard Time' (which has no DST), and CST-9:30 for the Northern Territory of Australia. The abbreviations have to be exactly 3 letters, and have no meaning other than as labels on the output."

where
Python type:unicode or None
Default value:None
Minimum length:1

SQL WHERE clause expression that specifies the subset of rows to load from the table. If this parameter is not provided, all of the rows will be loaded. If this parameter is provided but the table does not support WHERE clauses, an error will be raised.

The exact syntax of this expression depends on the database containing the table and the type of connection used to access it. If you are using the ArcGIS geoprocessor to access the database, ESRI recommends you reference fields using the following syntax:

orderBy
Python type:list of unicode, or None
Default value:None
Minimum length:0

Fields that will be used to sort the rows of the table before they are loaded into the data frame (i.e., the columns specified in the ORDER BY clause of a SQL SELECT statement). If no fields are provided, the rows will be sorted in the default order determined by the underlying database. If this parameter is provided but the underlying database does not support ORDER BY clauses, an error will be raised.

In addition to specifying the ORDER BY fields, you must also specify the sort direction for each field.

directions
Python type:list of unicode, or None
Default value:None
Minimum length:0

List of strings, either 'Ascending' or 'Descending', that specify the sort directions for the ORDER BY fields. If this parameter is provided but the underlying database does not support ORDER BY clauses, an error will be raised.