FAQ Database Discussion Community


Compute “substring” distances between sequences

traminer
My dataset (first line = header) is the following: ID;Activity 1;Activity 2; ... ;Activity 20; Company_X;A1A3T1D1O1R1R8;A1A3T2O1R2;...;A1A3T6D2O1O2R2 Company_Y;A1A3T1O1R1;A1A3T2O1R2;...;A1A3T11O1O3R5 Company Z;A1A3T1D8O1R1R8;A1A3T2O1R2;...;A1A3T6D2O1R2 where for each activity, each pair (one letter + one number) represents on part of a sequence. A1=actor1, A3=actor3, O1=object1. What I try to do is to compute the difference between...

Keeping the label order on the y-axis when using seqpcplot in TraMineR

r,traminer
I'm using the R package TraMineR. I would like to plot frequent event sequences by using the command seqpcplot. I previously coded the states in the alphabet as to keep them in alphabetical order so that when I compute the sequences by using the seqdef command without specifying the labels...

Which way non-symmetric cost matrices work?

traminer
I was trying to answer to this question Traminer substitution cost And it occurred to me that I don't really know in what direction the matrix is treated by TraMineR. Let's say for example that i have the following matrix A B A 0 1 B 2 0 does that...

What to do when dput() doesn't work?

r,data-manipulation,traminer
I usually use dput() to a) save R objects, and b) to understand their internal structure. However, in the TraMineR package I encounter something I haven't seen before: library(TraMineR) data(actcal.tse) actcal.seqe <- seqecreate(id = actcal.tse$id, timestamp = actcal.tse$time, event = actcal.tse$event) dput(head(actcal.seqe)) this returns: structure(list(<pointer: 0x1016201b0>, <pointer: 0x101603940>, <pointer: 0x101615330>,...

How to create a state sequence from an event sequence in TraMineR?

r,traminer
I've created a state sequence using the code: comp.seq <- seqdef(comp,NULL,states=comp.scodes,labels=comp.labels, alphabet=comp.alphabet,right="Z",left="Z") then i created a event sequence from that using: comp.seqe<-seqecreate(comp.seq,tevent="state", use.labels=FALSE) Then I searched for subsequences using: subs <- seqefsub(comp.seqe,strsubseq=c("(A)-(C)-(A)")) Now all I wanna do is create some plots of the resulting sequences. But I found out that...

Identifying indices of sequences which contain frequent subsequences

r,traminer
Using TraMineR I can identify frequent subsequences in a dataset of sequences. However, it only gives me a count of how often such a subsequence occur in the overall dataset, such as that it occurs in 21/22 sequences. Is there any way of getting indices of exactly which sequences contain...

Plot Event sequences / Event Sequences Clustering

r,traminer
Perhaps this is a veru dull question, but I did my research on it and couldn't find an answer. I want to plot my event sequences in the same way we plot sequences of states using seqIplot, seqfplot, seqdplot and seqmtplot. seqplot in general. when I try to do so...

Sequence index plots in ggplot2 using geom_tile( )

r,ggplot2,traminer
I'm trying to use ggplot to create sequence plots, for the sake of keeping the same visual style within my paper using sequence analysis. I do: library(ggplot2) library(TraMineR) library(dplyr) library(tidyr) data(mvad) mvad_seq<-seqdef(mvad,15:length(mvad)) mvad_trate<-seqsubm(mvad_seq,method="TRATE") mvad_dist<-seqdist(mvad_seq,method="OM",sm=mvad_trate) cluster<-cutree(hclust(d=as.dist(mvad_dist),method="ward.D2"),k=6) mvad$cluster<-cluster...

Extracting data from TraMineR for use in other plotting packages (e.g. ggplot2)

r,ggplot2,traminer
I am writing a paper using TraMineR for sequence plotting and ggplot for the remaining graphs. I would like to extract the data that seqIplot( ) uses to create index plots and use it to make an index plot using geom_tile( ), for the sake of maintaining the same visual...