我的数据看起来像这样:
的输出dput(sequence_data)
;
structure(list(Obs = 1:13, Seq.1 = structure(c(1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L), .Label = c("a", "b", "c"
), class = "factor"), Seq.2 = structure(c(1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("c", "d"), class = "factor"),
Seq.3 = structure(c(1L, 1L, 1L, 2L, 1L, 1L, 3L, 3L, 3L, 3L,
3L, 3L, 3L), .Label = c("", "d", "e"), class = "factor"),
Seq.4 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
1L, 1L, 2L), .Label = c("", "f"), class = "factor")), .Names = c("Obs",
"Seq.1", "Seq.2", "Seq.3", "Seq.4"), class = "data.frame", row.names = c(NA,
-13L))
我正在尝试获取过渡状态图。这是代码:
transitions <- table(sequence_data$Seq.1,sequence_data$Seq.2) %>%
getRefClass("Transition")$new(label=c("1st Iteration", "2nd Iteration"))
transitions$box_width = 0.25;
transitions$box_label_cex = 0.7;
transitions$arrow_type = "simple";
transitions$arrow_rez = 300;
table(sequence_data$Seq.2,sequence_data$Seq.3) %>% transitions$addTransitions(label = '3rd Iteration')
transitions$render()
可以从 te 图中删除空值以使其看起来更干净吗?我试图删除但表语句需要值具有相同的长度。
我正在library(Gmisc)
为图表使用 GMISC 包 ( )。
谢谢