RowNormalizeTransform
Description
td_row_normalize_transform_sqle()
function normalizes input columns row-wise, using
td_row_normalize_fit_sqle()
function output.
Usage
td_row_normalize_transform_sqle (
data = NULL,
object = NULL,
accumulate = NULL,
...
)
Arguments
data |
Required Argument. |
object |
Required Argument. |
accumulate |
Optional Argument. |
... |
Specifies the generic keyword arguments SQLE functions accept. volatile: 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:
Note: |
Value
Function returns an object of class "td_row_normalize_transform_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):
output.data
result
Examples
# Get the current context/connection.
con <- td_get_context()$connection
# Load the example data.
loadExampleData("tdplyr_example", "numerics")
# Create tbl_teradata.
numerics <- tbl(con, "numerics")
# Check the list of available analytic functions.
display_analytic_functions()
# Example 1: Normalize "smallint_col" and "integer_col" columns using "INDEX"
# approach, "integer_col" as base column and base value as 100.
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.
print(fit_obj$result)
print(fit_obj$output.data)
# Normalize the columns and accumulate the result by "id_col" column.
# Note that tbl_teradata representing the model is passed as
# input to "object".
obj <- td_row_normalize_transform_sqle(data=numerics,
object=fit_obj$result,
accumulate="id_col")
# Print the result.
print(obj$result)
# Example 2: Function to normalize the columns and accumulate the result
# by "id_col" column. Note that model is passed as instance of
# td_row_normalize_fit_sqle to "object".
obj1 <- td_row_normalize_transform_sqle(data=numerics,
object=fit_obj,
accumulate="id_col")
# Print the result.
print(obj1$result)
# Alternatively use S3 transform function to run transform on the output of
# td_row_normalize_fit_sqle() function.
obj1 <- transform(fit_obj,
data=numerics,
accumulate="id_col")
# Print the result.
print(obj1$result)