R Under development (unstable) (2025-11-24 r89059 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > ### ceeboo 2015 > > library("arulesSequences") Loading required package: arules Loading required package: Matrix Attaching package: 'arules' The following objects are masked from 'package:base': abbreviate, write Attaching package: 'arulesSequences' The following object is masked from 'package:arules': itemsets > > ## use example > data(zaki) > ## IGNORE_RDIFF_BEGIN > s7 <- cspade(zaki, parameter = list(support = .25), + control = list(verbose = TRUE, tidLists = TRUE)) parameter specification: support : 0.25 maxsize : 10 maxlen : 10 algorithmic control: bfstype : FALSE verbose : TRUE summary : FALSE tidLists : TRUE preprocessing ... 1 partition(s), 0 MB [0.02s] mining transactions ... 0.12 MB [0.04s] reading sequences ... [0.69s] total elapsed time: 0.75s > ## IGNORE_RDIFF_END > > ## IGNORE_RDIFF_BEGIN > k <- support(s7, zaki, control = list(verbose = TRUE)) preprocessing ... [0.02s] > ## IGNORE_RDIFF_END > table(size(s7), sign(quality(s7)$support - k)) 0 1 31 2 328 3 1353 4 2205 > > ## random atomic sequences > ## > ## Remove eventually. > suppressWarnings(RNGversion("3.5.0")) > ## > set.seed(20150921) > > f <- tempfile() > local({ + n <- 1000 + l <- 30 + k <- 5 + + s <- lapply(sample(1:l, n, TRUE), function(x) + sample(1:k, x, TRUE) + ) + + m <- sapply(s, length) + s <- cbind( + rep(1:n, m), + unlist(lapply(m, seq)), + unlist(s) + ) + + write.table(s, file = f, row.names = FALSE, col.names = FALSE) + }) > > ## use generated data > t <- read_baskets(con = f, + info = c("sequenceID", "eventID")) > unlink(f) > > ## use low support > ## IGNORE_RDIFF_BEGIN > s1 <- cspade(t, parameter = list(support = .17), + control = list(verbose = TRUE)) parameter specification: support : 0.17 maxsize : 10 maxlen : 10 algorithmic control: bfstype : FALSE verbose : TRUE summary : FALSE tidLists : FALSE preprocessing ... 1 partition(s), 0.35 MB [0.04s] mining transactions ... 0.31 MB [0.25s] reading sequences ... [1.8s] total elapsed time: 2.11s > ## IGNORE_RDIFF_END > summary(s1) set of 8616 sequences with most frequent items: 2 3 4 1 5 (Other) 6594 6354 6171 5582 5352 0 most frequent elements: {2} {3} {4} {1} {5} (Other) 6594 6354 6171 5582 5352 0 element (sequence) size distribution: sizes 1 2 3 4 5 6 5 25 125 625 3125 4711 sequence length distribution: lengths 1 2 3 4 5 6 5 25 125 625 3125 4711 summary of quality measures: support Min. :0.1700 1st Qu.:0.1740 Median :0.1820 Mean :0.2301 3rd Qu.:0.2660 Max. :0.8790 includes transaction ID lists: FALSE mining info: data ntransactions nsequences support t 15391 1000 0.17 > > ## > ## IGNORE_RDIFF_BEGIN > k <- support(s1, t, control = list(verbose = TRUE)) preprocessing ... [0.01s] > ## IGNORE_RDIFF_END > table(size(s1), sign(quality(s1)$support - k)) 0 1 5 2 25 3 125 4 625 5 3125 6 4711 > > ## internal > ## IGNORE_RDIFF_BEGIN > stopifnot(all.equal( + .Call(arulesSequences:::R_pnscount, s1@data, s1@data, + s1@elements@items@data, FALSE), + .Call(arulesSequences:::R_pnscount, s1@data, s1@data, NULL, TRUE) + )) > ## IGNORE_RDIFF_END > > ## IGNORE_RDIFF_BEGIN > stopifnot(all.equal( + .Call(arulesSequences:::R_pnsclosed, s1@data, + s1@elements@items@data, rep(1L, length(s1)), TRUE), + is.maximal(s1) + )) > ## IGNORE_RDIFF_END > > > ## IGNORE_RDIFF_BEGIN > stopifnot(all.equal( + .Call(arulesSequences:::R_pnsredundant, s1@data, + s1@elements@items@data, rep(1L, length(s1)), TRUE), + size(s1) > 1L + )) > ## IGNORE_RDIFF_END > > warnings() > ### > > > proc.time() user system elapsed 4.79 0.26 5.31