有谁知道如何从SPS格式给出的seqrep输出中提取代表性序列?这对seqrplot的情节 Spectator 非常有帮助 .
您可以使用 format = 'SPS' 参数打印输出 . 我用 biofam 数据说明
format = 'SPS'
biofam
data(biofam) biofam.lab <- c("Parent", "Left", "Married", "Left+Marr", "Child", "Left+Child", "Left+Marr+Child", "Divorced") biofam.seq <- seqdef(biofam, 10:25, labels=biofam.lab) ## Computing the distance matrix costs <- seqcost(biofam.seq, method="INDELSLOG") biofam.om <- seqdist(biofam.seq, method="OM", sm=costs$sm, indel=costs$indel) ## Representative set using the neighborhood density criterion biofam.rep <- seqrep(biofam.seq, diss=biofam.om, criterion="density") print(biofam.rep, format="SPS") ## Sequence ## [1] (0,16) ## [2] (0,9)-(3,1)-(6,6) ## [3] (0,6)-(1,10)
如果要以SPS形式检索代表性序列,可以使用 seqformat 和 seqconc :
seqformat
seqconc
biofam.rep.sps <- seqconc(seqformat(biofam.rep, to='SPS'))
结果是单个列矩阵,每个代表性序列存储为字符串 .
1 回答
您可以使用
format = 'SPS'
参数打印输出 . 我用biofam
数据说明如果要以SPS形式检索代表性序列,可以使用
seqformat
和seqconc
:结果是单个列矩阵,每个代表性序列存储为字符串 .