Teradata Package for R Function Reference | 17.20 - Sessionize - 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
Product Category
Teradata Vantage

Sessionize

Description

td_sessionize_sqle() function maps each click in a session to a unique session identifier.

Usage

  td_sessionize_sqle (
      data = NULL,
      time.column = NULL,
      time.out = NULL,
      click.lag = NULL,
      emit.null = FALSE,
      ...
  )

Arguments

data

Required Argument.
Specifies the input tbl_teradata.
Types: tbl_teradata

time.column

Required Argument.
Specifies the name of the input column that contains the click times.
Note: The "time.column" must also be an "order_column".
Types: character

time.out

Required Argument.
Specifies the number of seconds at which the session times out. If "time.out" seconds elapse after a click, then the next click starts a new session.
Types: float

click.lag

Optional Argument.
Specifies the minimum number of seconds between clicks for the session user to be considered human. If clicks are more frequent, indicating that the user is a bot, the function ignores the session.
The "click.lag" must be less than "time.out".
Types: float

emit.null

Optional Argument.
Specifies whether to output rows that have NULL values in their session id and rapid fire columns, even if their timestamp_column has a NULL value.
Default Value: FALSE
Types: logical

...

Specifies the generic keyword arguments SQLE functions accept.
Below are the generic keyword arguments:

persist:
Optional Argument.
Specifies whether to persist the results of the function in a table or not.
When set to TRUE, results are persisted in a table; otherwise, results are garbage collected at the end of the session.
Default Value: FALSE
Types: logical

volatile:
Optional Argument.
Specifies whether to put the results of the function in a volatile table or not.
When set to TRUE, results are stored in a volatile table, otherwise not.
Default Value: FALSE
Types: logical

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:

  • "<input.data.arg.name>.partition.column" accepts character OR vector of Strings (character) (Strings)

  • "<input.data.arg.name>.hash.column" accepts character OR vector of Strings (character) (Strings)

  • "<input.data.arg.name>.order.column" accepts character OR vector of Strings (character) (Strings)

  • "local.order.<input.data.arg.name>" accepts logical

Note:
These generic arguments are supported by tdplyr if the underlying SQL Engine function supports, else an exception is raised.

Value

Function returns an object of class "td_sessionize_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("sessionize_example", "sessionize_table")
    
    # Create tbl_teradata object.
    sessionize_data <- tbl(con, "sessionize_table")
    
    # Check the list of available analytic functions.
    display_analytic_functions()
    
    # Example 1: Mapping each click in a session to a unique session identifier.
    #            by partition column 'partition_id' and order column 'clicktime'.
    obj <- td_sessionize_sqle(data=sessionize_data,
                              data.partition.column='partition_id',
                              data.order.column='clicktime',
                              time.column='clicktime',
                              time.out=60.0,
                              click.lag=0.2)
    
    # Print the result.
    print(obj$result)