subset.td.data.frame: Subsetting a Teradata Data Frame

Description Usage Arguments Details Value Examples

View source: R/subset.td.data.frame.R

Description

Return subsets of teradata data frames which meet conditions.

Usage

1
2
## S3 method for class 'td.data.frame'
subset(x, subset, select, drop = FALSE, ...)

Arguments

x

td data frame to be subset.

subset

logical expression indicating rows to keep.

select

expression, indicating columns to select from a teradata data frame.

drop

passed on to [ indexing operator.

...

Allow other commands to be sent to plot.

Details

This is a generic function, with methods supplied for teradata data frames.

The subset argument works on the rows. Note that subset will be evaluated in the teradata data frame, so columns can be referred to (by name) as variables in the expression (see the examples).

It works by first replacing column names in the selection expression with the corresponding column numbers in the teradata data frame and then using the resulting integer vector to index the columns. This allows the use of the standard indexing conventions so that for example ranges of columns can be specified easily, or single columns can be dropped (see the examples).

Value

An object similar to x but which adds the subset condtion which is used when accessing the real Teradata table.

Examples

1
2
3
4
5
## Not run: 
subset(tdf, age >= 65, select = income:married)
subset(tdf, gender == 'F', select = -age)

## End(Not run)

nonsleepr/teradataR documentation built on May 23, 2019, 9:32 p.m.