Creating transactions with temporal information
In addition to mining interesting associations within the transaction database, we can mine interesting sequential patterns using transactions with temporal information. In the following recipe, we demonstrate how to create transactions with temporal information from a web traffic dataset.
Getting ready
Download the web_traffic.csv
dataset from the https://github.com/ywchiu/rcookbook/raw/master/chapter9/traffic.RData GitHub link.
We can then generate transactions from the loaded dataset for frequent sequential pattern mining.
How to do it…
Perform the following steps to create transactions with temporal information:
- First, install and load the
arulesSequences
package:> install.packages("arulesSequences") > library(arulesSequences)
- Load web traffic data into an R session:
> load('traffic.RData')
- Create the transaction data with temporal information:
> traffic_data<-data.frame(item=traffic$Page) > traffic...