Transform
Description
The td_transform_sqle()
function applies numeric transformations
to input columns, using td_fit_sqle()
output.
Usage
td_transform_sqle (
data = NULL,
object = NULL,
id.columns = NULL,
...
)
Arguments
data |
Required Argument. |
object |
Required Argument. |
id.columns |
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_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):result
Examples
# Get the current context/connection.
con <- td_get_context()$connection
# Load the example data.
loadExampleData("tdplyr_example", "iris_input", "transformation_table")
# Create tbl_teradata object.
iris_input <- tbl(con, "iris_input")
transformation_df <- tbl(con, "transformation_table")
transformation_df <- transformation_df
# Check the list of available analytic functions.
display_analytic_functions()
# Example 1: Run td_fit_sqle() with all arguments
# and pass the output to td_transform_sqle().
fit_df <- td_fit_sqle(data=iris_input,
object=transformation_df,
object.order.column='targetcolumn')
# Run td_transform_sqle() with persist as TRUE in order to save the result.
# Note that tbl_teradata representing the model is passed as
# input to "object".
transform_result <- td_transform_sqle(data=iris_input,
data.partition.column='sepal_length',
data.order.column='sepal_length',
object=fit_df$result,
object.order.column='targetcolumn',
id.columns=c('species', 'id'),
persist=TRUE)
# Print the result.
print(transform_result$result)
# Example 2: Transform the 'petal_length', 'sepal_length', 'petal_width',
# 'sepal_width' according to transformation_df tbl_teradata.
# Note that model is passed as instance of td_fit to "object".
transform_result1 <- td_transform_sqle(data=iris_input,
data.partition.column='sepal_length',
data.order.column='sepal_length',
object=fit_df,
object.order.column='targetcolumn',
id.columns=c('species', 'id'),
persist=TRUE)
# Print the result.
print(transform_result1$result)
# Alternatively use S3 transform function to run transform on the output of
# td_fit_sqle() function.
transform_result1 <- transform(fit_df,
data=iris_input,
data.partition.column='sepal_length',
data.order.column='sepal_length',
object.order.column='targetcolumn',
id.columns=c('species', 'id'))
# Print the result.
print(transform_result1$result)