How to compute dissimilarities between sequences when sequences contain gaps?
问题 I want to cluster sequences with optimal matching with TraMineR::seqdist() from data that contains missings, i.e. sequences containing gaps. library(TraMineR) data(ex1) sum(is.na(ex1)) # [1] 38 sq <- seqdef(ex1[1:13]) sq # Sequence # s1 *-*-*-A-A-A-A-A-A-A-A-A-A # s2 D-D-D-B-B-B-B-B-B-B # s3 *-D-D-D-D-D-D-D-D-D-D # s4 A-A-*-*-B-B-B-B-D-D # s5 A-*-A-A-A-A-*-A-A-A # s6 *-*-*-C-C-C-C-C-C-C # s7 *-*-*-*-*-*-*-*-*-*-*-*-* sm <- seqsubm(sq, method='TRATE') round(sm,digits=3) # A-> B-> C-> D-> # A->