#' List of SQS's found in each Sequence
#'
#'Wrapper for function SQS, produces the possible sequence silhouettes for each sequence in the list.
#'
#' @param seqlist List of sequences.
#' @param k Maximum length of sequence silhouette.
#'
#' @return List of SQS's found in each sequence.
#' @export
#'
#' @examples
#' df<-data.frame(Time=c("2020-01-01 00:10:09", "2020-01-01 01:12:34" , "2020-01-02 06:38:09",
#' "2020-01-02 07:21:51"),Cat=c('A','B','A','C'))
#' #For daily data:
#' seqlist<-SeqList(df,'%Y-%m-%d')
#' SQSList(seqlist,2)
SQSList <- function(seqlist, k) {
transitionvector <- vector("list", length(seqlist))
j <- 1
for (i in 1:length(seqlist)) {
if (!is.na(seqlist[[j]][1, 1])) {
transitionvector[[j]] <- rbind(SQS(seqlist[[j]][, 2], k))
j <- j + 1
} else {
transitionvector[[j]] <- cbind(0, 0, 0)
j <- j + 1
}
}
vectornames <- stats::setNames(transitionvector, paste0(1:length(seqlist)))
return(transitionvector)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.