BincodeFit
Description
The td_bincode_fit_sqle()
function outputs a tbl_teradata of information to
input to td_bincode_transform_sqle()
function, which bin-codes
the specified input tbl_teradata.
Bin-coding is typically used to convert numeric data to categorical data by
binning the numeric data into multiple numeric bins (intervals).
The bins can have a fixed-width with auto-generated labels or can have
variable widths and labels.
Usage
td_bincode_fit_sqle (
data = NULL,
fit.data = NULL,
target.columns = NULL,
method.type = NULL,
nbins = NULL,
label.prefix = NULL,
target.colnames = NULL,
minvalue.column = NULL,
maxvalue.column = NULL,
label.column = NULL,
...
)
Arguments
data |
Required Argument. |
fit.data |
Optional Argument. |
target.columns |
Required Argument. |
method.type |
Required Argument. |
nbins |
Optional Argument. |
label.prefix |
Optional Argument. |
target.colnames |
Optional Argument. |
minvalue.column |
Optional Argument. |
maxvalue.column |
Optional Argument. |
label.column |
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_bincode_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):
result
output.data
Examples
# Get the current context/connection.
con <- td_get_context()$connection
# Load the example data.
loadExampleData("tdplyr_example", "titanic", "bin_fit_ip")
# Create tbl_teradata object.
titanic_data <- tbl(con, "titanic")
bin_fit_ip <- tbl(con, "bin_fit_ip")
# Check the list of available analytic functions.
display_analytic_functions()
# Example 1: Transform the data using td_bincode_fit_sqle() with
# 'method.type' as 'Variable-Width'.
bin_code_1 <- td_bincode_fit_sqle(data=titanic_data,
fit.data=bin_fit_ip,
fit.data.order.column = c('minVal',
'maxVal'),
target.columns='age',
minvalue.column='minVal',
maxvalue.column='maxVal',
label.column='label',
method.type='Variable-Width',
label.prefix='label.prefix'
)
# Print the result.
print(bin_code_1$result)
# Example 2: Transform the data using td_bincode_fit_sqle() with
# 'method.type' as 'Equal-Width'.
bin_code_2 <- td_bincode_fit_sqle(data=titanic_data,
target.columns='age',
method.type='Equal-Width',
nbins=2,
label.prefix='label.prefix'
)
# Print the result.
print(bin_code_2$result)