每个集群在每个状态中花费的平均时间 - TramineR
Mean time spent in each state per cluster - TramineR
我想创建一个 table(而不是绘图),其中包含在每个集群的每个状态中花费的平均时间。有没有办法用 TramineR 做到这一点?
可能的解决方案
seqmtplot(df_new.seq, group = cl1.4fac)
by(df_new.seq, cl1.4fac, seqistatd) ->a
然后我将这些值保存到一个新的数据框中
b<-a[["Type 8"]]
b<-as.data.frame(b)
我计算了均值
mean(b$Work)
序列集的平均时间由函数 seqmeant
提供。因此,您可以简单地做
by(df_new_seq, cl.4fac, seqmeant)
如果你想要矩阵形式的结果
res <- by(df_new_seq, cl.4fac, seqmeant)
mres <- matrix(unlist(res), nrow=nrow(res[[1]]), byrow=FALSE)
rownames(mres) <- rownames(res[[1]])
我想创建一个 table(而不是绘图),其中包含在每个集群的每个状态中花费的平均时间。有没有办法用 TramineR 做到这一点?
可能的解决方案
seqmtplot(df_new.seq, group = cl1.4fac)
by(df_new.seq, cl1.4fac, seqistatd) ->a
然后我将这些值保存到一个新的数据框中
b<-a[["Type 8"]]
b<-as.data.frame(b)
我计算了均值
mean(b$Work)
序列集的平均时间由函数 seqmeant
提供。因此,您可以简单地做
by(df_new_seq, cl.4fac, seqmeant)
如果你想要矩阵形式的结果
res <- by(df_new_seq, cl.4fac, seqmeant)
mres <- matrix(unlist(res), nrow=nrow(res[[1]]), byrow=FALSE)
rownames(mres) <- rownames(res[[1]])