Histogram
Description
The td_histogram_sqle()
function calculates the frequency distribution of a data set
using any of these methods:
Sturges
Scott
Variable-width
Equal-width
Notes:
This function requires the UTF8 client character set for UNICODE data.
This function does not support Pass Through Characters (PTCs).
This function does not support KanjiSJIS or Graphic data types.
Usage
td_histogram_sqle (
data = NULL,
object = NULL,
target.columns = NULL,
method.type = NULL,
nbins = 1,
inclusion = "LEFT",
groupby.columns = NULL,
...
)
Arguments
data |
Required Argument. |
object |
Required when "method.type" is 'VARIABLE-WIDTH', optional otherwise. |
target.columns |
Required Argument. |
method.type |
Required Argument.
Types: character |
nbins |
Required when "method.type" is 'VARIABLE-WIDTH' and 'EQUAL-WIDTH',
optional otherwise.
Default Value: 1 |
inclusion |
Optional Argument.
Default Value: "LEFT" |
groupby.columns |
Optional Argument.
Types: character OR vector of Strings (character) |
... |
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_histogram_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", "titanic", "min_max_titanic")
# Create tbl_teradata object.
titanic_data <- tbl(con, "titanic")
# Create tbl_teradata object for minimum and maximum value of bin
# "Young age", "Middle Age" and, "Old Age".
min_max_object <- tbl(con, "min_max_titanic")
# Check the list of available analytic functions.
display_analytic_functions()
# Example 1: Get the frequency distribution of a data set using 'STURGES'
# method type for the values in column 'age'.
obj1 <- td_histogram_sqle(data=titanic_data,
target.columns="age",
method.type="STURGES")
# Print the result.
print(obj1$result)
# Example 2: Get the frequency distribution of a data set using 'VARIABLE-WIDTH'
# method type for the values in column 'age' with 3 number of bins.
obj2 <- td_histogram_sqle(data=titanic_data,
object=min_max_object,
target.columns="age",
method.type="VARIABLE-WIDTH",
nbins=3)
# Print the result.
print(obj2$result)
# Example 3: Get the frequency distribution of a data set with respect
# to 'sex' column using 'EQUAL-WIDTH' method type for the
# values in column 'age' and 'fare' with 3 and 2 number
# of bins respectively.
obj3 <- td_histogram_sqle(data=titanic_data,
target.columns=c("age", "fare"),
method.type="EQUAL-WIDTH",
nbins=c(3,2),
groupby.columns=c("sex"))
# Print the result.
print(obj3$result)