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

Product
Teradata Package for R
Release Number
17.00
Published
July 2021
Language
English (United States)
Last Update
2023-08-08
dita:id
B700-4007
NMT
no
Product Category
Teradata Vantage
PathSummarizer

Description

The PathSummarizer function takes output of the function PathGenerator (td_path_generator_mle) and returns, for each prefix in the input tbl_teradata, the parent and children and number of times each of its subsequences was traveled. This output can be input to PathStart (td_path_start_mle) function.

Usage

  td_path_summarizer_mle (
      object = NULL,
      object.partition.column = NULL,
      seq.column = NULL,
      partition.names = NULL,
      count.column = NULL,
      delimiter = ",",
      hash = FALSE,
      prefix.column = NULL,
      object.order.column = NULL,
      object.sequence.column = NULL
  )

Arguments

object

Required Argument.
Specifies the name of the object returned by the PathGenerator (td_path_generator_mle) function, or the output tbl_teradata containing the generated paths.

object.partition.column

Required Argument.
Specifies Partition By columns for "object".
Values to this argument can be provided as a vector, if multiple columns are used for partition.
Types: character OR vector of Strings (character)

object.order.column

Optional Argument.
Specifies Order By columns for "object".
Values to this argument can be provided as a vector, if multiple columns are used for ordering.
Types: character OR vector of Strings (character)

count.column

Optional Argument.
Specifies the name of the input tbl_teradata column that contains the number of times a path was traveled.
Types: character

delimiter

Optional Argument.
Specifies the single-character delimiter that separates symbols in the path string.
Note: Do not use any of the following characters as delimiter (they cause the function to fail): Asterisk (*), Plus (+), Left parenthesis ((), Right parenthesis ()), Single quotation mark ('), Escaped single quotation mark (\'), Backslash (\).
Default Value: ","
Types: character

seq.column

Required Argument.
Specifies the name of the input tbl_teradata column that contains the paths.
Types: character

partition.names

Required Argument.
Lists the names of the columns that the "object.partition.column" clause specifies. The function uses these names for output tbl_teradata columns. This argument and the "object.partition.column" clause must specify the same names in the same order.
Types: character OR vector of characters

hash

Optional Argument.
Specifies whether to include the hash code of the node in the output table.
Default Value: FALSE
Types: logical

prefix.column

Required Argument.
Specifies the name of the input column that contains the node prefixes.
Types: character

object.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "object". The argument is used to ensure deterministic results for functions which produce results that vary from run to run.
Types: character OR vector of Strings (character)

Value

Function returns an object of class "td_path_summarizer_mle" which is a named list containing object of class "tbl_teradata".
Named list member can be referenced directly with the "$" operator using the name: result.

Examples

  
    # Get the current context/connection
    con <- td_get_context()$connection
    # Load example data.
    loadExampleData("pathgenerator_example", "clickstream1")
    
    # Create remote tibble objects.
    # The table contains clickstream data, where the "path" column
    # contains symbols for the pages that the customer clicked.
    clickstream1 <- tbl(con, "clickstream1")
    
    # Example 1 - td_path_summarizer_mle() uses the output of td_path_generator_mle().
    td_path_generator_out <- td_path_generator_mle(data = clickstream1,
                                               seq.column = "path"
                                               )
    td_path_summarizer_out1 <- td_path_summarizer_mle(object = td_path_generator_out,
                                                  object.partition.column = c('prefix'),
                                                  seq.column = 'sequence',
                                                  partition.names = 'prefix',
                                                  prefix.column = 'prefix'
                                                )
    # Example 2 - Alternatively, persist and use the output table of td_path_generator_mle().
    generated_path_table <- td_path_generator_out %>% extract2(1) %>% copy_to(con, df = .)

    td_path_summarizer_out2 <- td_path_summarizer_mle(object = generated_path_table,
                                                  object.partition.column = c('prefix'),
                                                  seq.column = 'sequence',
                                                  partition.names = 'prefix',
                                                  prefix.column = 'prefix'
                                                )