cluster_ts | R Documentation |
Cluster interactions data together as long as they fall into a starting ts + time window length. Independent of badges. Assumes that x is ordered by timestamp (date) field in increasing order. This is useful to group consecutive detects into one continuous session. The "twl" defines the separation in terms of time that needs to pass between sequential detects in order to close one session and start the next.
The literature indicates a timewindow of 2min approx to count an ongoing interaction as one or two separate interactions.
cluster_ts(x, twl = 120, force.cut = "none", clusterOffset = 1)
## S3 method for class 'smtrx'
cluster_ts(x, twl = 120, force.cut = "none", clusterOffset = 1)
x |
Dataframe of interaction data. |
twl |
Integer indicating the length of the time window in seconds within which detects fall into the same cluster. If two detects are further apart in time than twl, a new cluster is created. |
force.cut |
String, one of c("none", "twl", "nrows", "ncluster"). Default is "none", meaning that cluster reflects timestamp data overlaps, i.e. the session end time expands with each new detect that falls within the time window. If set to "twl" the clusters will be enforced to be of equal duration of twl seconds, independently if subsequent ts detects fall into the same time window. If set to "nrows", twl will be interpreted as number of rows to be included in each cluster. If set to "ncluster", twl will be read as the total number of clusters to be created. |
clusterOffset |
Integer. Starting number of the cluster count |
A data.frame. The original dataframe plus a clusterTS column indicating the group into which the current ts falls
smtrx
: Cluster timestamps of smtrx data
cluster_ids
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.