x <- read.table("clipboard", header=T)
head(x)

> head(x)
  acnt_key X2013.09 X2013.10 X2013.11 X2013.12 X2014.01 X2014.02
1    48935     vvip     vvip      vip     朱     朱     朱
2   117140     vvip        X        X        X        X     朱
3   252239     vvip        X        X        X        X        X
4   616962     vvip        X        X        X        X        X
5   667645     vvip      vip      vip     朱      vip        X
6  1254180     vvip        X        X        X        X        X

#library(TraMineR)
#x.labels <- c('vvip','vip','BU','x')
#x.scode <- c('vvip','vip','BU','x')
#x.seq <- seqdef(x, 2:7, states = x.scode, labels = x.labels)

x.seq <- seqdef(x, c(2:7))
head(x.seq)
#seqiplot(x.seq)
#seqHtplot(x.seq)
#seqfplot(x.seq)
seqdplot(x.seq, border = NA)



#library(cluster)
submat <- seqsubm(x.seq, method = "TRATE")
dist.om1 <- seqdist(x.seq, method = "OM", indel = 1, sm = submat)
clusterward1 <- agnes(dist.om1, diss = TRUE, method = "ward")
#plot(clusterward1)
cl1.4 <- cutree(clusterward1, k = 4)
cl1.4fac <- factor(cl1.4, labels = paste("Type", 1:4))
#seqdplot(x.seq, group = cl1.4fac)
seqfplot(x.seq, group = cl1.4fac, border = NA)



mvad.seqe <- seqecreate(x.seq)
fsubseq <- seqefsub(mvad.seqe, pMinSupport = 0.05)
plot(fsubseq[1:10], cex=0.6, col=terrain.colors(10))
discr <- seqecmpgroup(fsubseq, group = cl1.4fac)
plot(discr[1:6])


蟲襷ろ                           Support    Count
---------------------------------- ---------- -----
(VVIP)-(VVIP>朱)-(朱>蟲襷れ) 0.31372549 80

 螳 覩碁..

VVIP,朱,蟲襷れ,蟲襷れ,蟲襷れ,蟲襷れ
VVIP,朱,蟲襷れ,蟲襷れ,蟲襷れ,朱
VVIP,朱,朱,蟲襷れ,蟲襷れ,蟲襷れ
VVIP,朱,朱,VVIP,朱,蟲襷れ
VVIP,VVIP,VVIP,VVIP,朱,蟲襷れ
VVIP,VVIP,朱,朱,蟲襷れ,蟲襷れ

谿瑚 襭 #