tdHead: tdHead

Description Usage Arguments Value See Also Examples

Description

Gets the top observations in a Teradata table. Can take a JDBC connection object (conn) if provided. If no JDBC connection is provided, then a connection is attempted using the user, and password provided. If none is provided, then tries to locate a connection object (conn) in the global environment.

If a connection profile (e.g. username, password, etc.) is provided, then an attempt is made to connect to Teradata. Once the query is run, the connection is then closed. If a connection object (conn) is provided to the function (or one is found globally), then the connection remains open.

Usage

1
tdHead(table = NULL, n = 10, cols = NULL, where = "", ...)

Arguments

table

A string stating the Teradata table name.

n

A single integer, representing the number of rows desired. Defaults to 10.

cols

Columns desired. Defaults to all columns.

where

String statement to subset table with.

...

Optional connection settings.

Value

Returns a data.frame of the the Teradata table with the first n observations.

See Also

tdConn for connection, tdNames for table names, td for general queries, tdCpu for CPU usage, and tdJoin for joining tables.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## NOT RUN (will also result in errors due to user restrictions) ##
## Runs a quick query based on connection profile
# tdHead("ICDB_PERSON", username=<username>, password=<password>, db="GCA")

## Runs query using a separately established connection. Selects 20 observations
# from only two columns, subset by even Person_Id.
# conn = tdConn(<username>, <password>, db="GCA")
# tdHead("ICDB_PERSON", 20, c("PERSON_ID", "INDIV_ID"), "PERSON_ID mod 2 = 0", conn=conn)

## Uses same connection, but allows code to find globally. Also subsets on PERSON_ID.
# tdHead("ICDB_PERSON")

tranlm/tdR documentation built on May 31, 2019, 7:45 p.m.