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

Description

The PathStart function takes output of the function PathSummarizer (td_path_summarizer) function and returns, for each parent in the input tbl_teradata, the parent and children and the number of times that each of its subsequences was traveled.

Usage

  td_path_start_mle (
      object = NULL,
      count.column = NULL,
      delimiter = ",",
      parent.column = NULL,
      partition.names = NULL,
      node.column = NULL,
      object.sequence.column = NULL,
      object.partition.column = NULL,
      object.order.column = NULL
  )

Arguments

object

Required Argument.
Specifies the name of the object returned by the td_path_summarizer_mle function, or the tbl_teradata containing the input data.

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

Required 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

parent.column

Required Argument.
Specifies the name of the input tbl_teradata column that contains the parent nodes. The "object.partition.column" clause in the function call must include this column.
Types: character

partition.names

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

node.column

Required Argument.
Specifies the name of the input tbl_teradata column that contains the nodes.
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_start_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_start_mle() uses the output of td_path_summarizer_mle().
    td_path_generator_out <- td_path_generator_mle(data = clickstream1,
                                               seq.column = "path"
                                               )
    td_path_summarizer_out <- td_path_summarizer_mle(object = td_path_generator_out,
                                                  object.partition.column = c('prefix'),
                                                  seq.column = 'sequence',
                                                  partition.names = 'prefix',
                                                  prefix.column = 'prefix'
                                                )
    td_path_start_out1 <- td_path_start_mle(object = td_path_summarizer_out,
                                          object.partition.column = c('parent'),
                                          node.column = 'node',
                                          parent.column = 'parent',
                                          count.column = 'cnt',
                                          partition.names = 'partitioned'
                                          )

    # Example 2 - Alternatively, use a persisted output of path summarizer
    td_path_summarizer_out %>% extract2(1) %>%
          copy_to(con, df = ., name = "td_path_summarizer_table", overwrite = TRUE)

    td_path_start_out2 <- td_path_start_mle(object = tbl(con, "td_path_summarizer_table"),
                                          object.partition.column = c('parent'),
                                          node.column = 'node',
                                          parent.column = 'parent',
                                          count.column = 'cnt',
                                          partition.names = 'partitioned'
                                          )