Teradata Package for R Function Reference | 17.00 - 17.00 - td_values_valib - Teradata Package for R

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B700-4007-090K
Language
English (United States)

Description

Use Values analysis as the first type of analysis performed on unknown data. Values analysis determines the nature and quality of the data. For example, whether the data is categorical or continuously numeric, how many null values it contains, and so on.

A Values analysis provides a count of rows, rows with non-null values, rows with null values, rows with value 0, rows with a positive value, rows with a negative value, and the number of rows containing blanks in the given column. By default, unique values are counted, but this calculation can be inhibited for performance reasons if desired.

For a column of non-numeric type, the zero, positive, and negative counts are always zero (for example, 000 is not counted as 0). A Values analysis can be performed on columns of any data type, though the measures displayed vary according to column type.

Usage

td_values_valib(data, columns, ...)

Arguments

data

Required Argument.
Specifies the input data to perform Values analysis.
Types: tbl_teradata

columns

Required Argument.
Specifies the name(s) of the column(s) to analyze. Occasionally, it can also accept permitted strings to specify all columns, or all numeric columns, or all character columns.
Permitted Values:

  1. Name(s) of the column(s) in "data".

  2. Pre-defined strings:

    1. 'all' - all columns

    2. 'allnumeric' - all numeric columns

    3. 'allcharacter' - all numeric and date columns

Types: character OR vector of Strings (character)

...

Specifies other arguments supported by the function as described in the 'Other Arguments' section.

Value

Function returns an object of class "td_values_valib" which is a named list containing object of class "tbl_teradata".
Named list member can be referenced directly with the "$" operator using name: result.

Other Arguments

exclude.columns

Optional Argument.
Specifies the name(s) of the column(s) to exclude from the analysis, if a column specifier such as 'all', 'allnumeric', 'allcharacter' is used in the "columns" argument.
Types: character OR vector of Strings (character)

group.columns

Optional Argument.
Specifies the name(s) of column(s) to perform separate analysis for each group.
Types: character OR vector of Strings (character)

distinct

Optional Argument.
Specifies whether to select unique values count for each selected column.
Default Value: FALSE
Types: logical

filter

Optional Argument.
Specifies the clause to filter rows selected for analysis within Values.
For example,
filter = "cust_id > 0"
Types: character

Examples

# Notes:
#   1. To execute Vantage Analytic Library functions, set options 'val.install.location' to
#      the database name where Vantage analytic library functions are installed.
#   2. Datasets used in these examples can be loaded using Vantage Analytic Library installer.

# Set the option 'val.install.location'.
options(val.install.location = "SYSLIB")

# Get remote data source connection.
con <- td_get_context()$connection

# Create an object of class "tbl_teradata".
df <- tbl(con, "customer")
print(df)

# Example 1: Perform Values analysis using default values on 'income' and
#            'marital_status' columns.
obj <- td_values_valib(data=df, columns=c("income", "marital_status"))

# Print the results.
print(obj$result)

# Example 2: Perform Values analysis on 'income' column with values grouped by
#            'gender' and only for rows with income greater than 0.
obj <- td_values_valib(data=df, columns="income", group.columns="gender", filter="income > 0")

# Print the results.
print(obj$result)