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

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
Sessionize

Description

The Sessionize function maps each click in a session to a unique session identifier. A session is defined as a sequence of clicks by one user that are separated by at most n seconds.

Usage

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

Arguments

data

Required Argument.
Specifies the input tbl_teradata object.

data.partition.column

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

data.order.column

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

time.column

Required Argument.
Specifies the name of the input column that contains the click times.
Note: The "time.column" must also be an "data.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: numeric

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: numeric

emit.null

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

Value

Function returns an object of class "td_sessionize_sqle" 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("sessionize_example", "sessionize_table")
    
    # Create object(s) of class "tbl_teradata".
    sessionize_table <- tbl(con, "sessionize_table")
    
    # Example 1 -
    # This example maps each click in a session to a unique session identifer,
    # which uses input table web clickstream data recorded as user navigates through a web site
    # based on events — view, click, and so on which are recorded with a timestamp.
    td_sessionize_out <- td_sessionize_sqle(data = sessionize_table,
                            data.partition.column = c("partition_id"),
                            data.order.column = c("clicktime"),
                            time.column = "clicktime",
                            time.out = 60,
                            click.lag = 0.2
                            )