Teradata Package for R Function Reference | 17.00 - 17.00 - show_query - 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

Function to return the underlying SQL query.

Usage

## S3 method for class 'td_analytics_valib'
show_query(obj)

Arguments

obj

Required Argument.
Specifies a tdplyr valib function object of class "td_analytics_valib".
Types: td_analytics_valib

Examples

# Notes:
#   1. To execute Vantage Analytic Library functions, set option '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_analysis")
print(df)

# Run td_decision_tree_valib() on columns "age", "income" and "nbr_children", with
# dependent variable "gender".
obj <- td_decision_tree_valib(data=df,
                              columns=c("age", "income", "nbr_children"),
                              response.column="gender",
                              algorithm="gainratio",
                              binning=FALSE,
                              max.depth=5,
                              num.splits=2,
                              pruning="gainratio")
# Print the SQL query.
print(obj %>% show_query())