Teradata Package for R Function Reference | 17.20 - RowNormalizeFit - Teradata Package for R - Look here for syntax, methods and examples for the functions included in the Teradata Package for R.

Teradata® Package for R Function Reference

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for R
Release Number
17.20
Published
March 2024
ft:locale
en-US
ft:lastEdition
2024-05-03
dita:id
TeradataR_FxRef_Enterprise_1720
Product Category
Teradata Vantage

RowNormalizeFit

Description

td_row_normalize_fit_sqle() function outputs a tbl_teradata containing parameters and specified input columns to input to td_row_normalize_transform_sqle() function, which normalizes the input columns row-wise.

Usage

  td_row_normalize_fit_sqle (
      data = NULL,
      target.columns = NULL,
      approach = "UNITVECTOR",
      base.column = NULL,
      base.value = NULL,
      ...
  )

Arguments

data

Required Argument.
Specifies the input tbl_teradata.
Types: tbl_teradata

target.columns

Required Argument.
Specifies the name(s) of the column(s) in "data" to normalize.
Types: character OR vector of Strings (character)

approach

Optional Argument.
Specifies the method to use for row wise normalization.
Permitted Values:

  • UNITVECTOR - X' = X / (sqrt (Σi ϵ [1, n] Xi2))

  • FRACTION - X' = X' = X / (Σi ϵ [1, n] Xi)

  • PERCENTAGE - X' = X*100 / (Σi ϵ [1, n] Xi)

  • INDEX - X' = V + ((X - B) / B) * 100

In the normalizing formulas:
X' is the normalized value.
X is the original value.
B is the value in the base column.
V is the base value.
Default Value: "UNITVECTOR"
Types: character

base.column

Required when "approach" is set to 'INDEX', ignored otherwise.
Specifies the base column to be used in INDEX "approach" formula.
Types: character

base.value

Required when "approach" is set to 'INDEX', ignored otherwise.
Specifies the base value to be used in INDEX "approach" formula.
Types: float OR integer

...

Specifies the generic keyword arguments SQLE functions accept.
Below are the generic keyword arguments:

persist:
Optional Argument.
Specifies whether to persist the results of the function in a table or not.
When set to TRUE, results are persisted in a table; otherwise, results are garbage collected at the end of the session.
Default Value: FALSE
Types: logical

volatile:
Optional Argument.
Specifies whether to put the results of the function in a volatile table or not.
When set to TRUE, results are stored in a volatile table, otherwise not.
Default Value: FALSE
Types: logical

Function allows the user to partition, hash, order or local order the input data. These generic arguments are available for each argument that accepts tbl_teradata as input and can be accessed as:

  • "<input.data.arg.name>.partition.column" accepts character OR vector of Strings (character) (Strings)

  • "<input.data.arg.name>.hash.column" accepts character OR vector of Strings (character) (Strings)

  • "<input.data.arg.name>.order.column" accepts character OR vector of Strings (character) (Strings)

  • "local.order.<input.data.arg.name>" accepts logical

Note:
These generic arguments are supported by tdplyr if the underlying SQL Engine function supports, else an exception is raised.

Value

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

  1. output.data

  2. result

Examples

  
    # Notes:\cr
    #     1. Get the connection to Vantage to execute the function.\cr
    #     2. One must import the required functions mentioned in
    #        the example from tdplyr.\cr
    #     3. Function will raise error if not supported on the Vantage
    #        user is connected to.\cr
    
    # Load the example data.
    loadExampleData("tdplyr_example", "numerics")
    
    # Create tbl_teradata object.
    numerics = tbl(con, "numerics")
    
    # Check the list of available analytic functions.
    display_analytic_functions()
    
    # Example 1: Create fit object to normalize "smallint_col" and "integer_col"
    #            columns using "INDEX" approach, "integer_col" as base column
    #            and base value as 100.0.
    fit_obj = td_row_normalize_fit_sqle(data=numerics,
                                        target.columns=c("integer_col", "smallint_col"),
                                        approach="INDEX",
                                        base.column="integer_col",
                                        base.value=100.0)
    
    # Print the result.\cr
    print(fit_obj$result)
    print(fit_obj$output.data)