来自 seqrep 的代表性序列的 SPS 格式
SPS format of representative sequence from seqrep
有谁知道如何从以 SPS 格式给出的 seqrep 输出中提取代表性序列? seqrplot 的情节的观众将非常有帮助。
您可以使用 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
:
biofam.rep.sps <- seqconc(seqformat(biofam.rep, to='SPS'))
结果是一个单列矩阵,每个代表序列存储为一个字符串。
有谁知道如何从以 SPS 格式给出的 seqrep 输出中提取代表性序列? seqrplot 的情节的观众将非常有帮助。
您可以使用 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
:
biofam.rep.sps <- seqconc(seqformat(biofam.rep, to='SPS'))
结果是一个单列矩阵,每个代表序列存储为一个字符串。