Teradata Package for R Function Reference | 17.20 - show_query - 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
lifecycle
latest
Product Category
Teradata Vantage
Get SQL query

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())