我正在与 TraMineR 合作对教育数据进行序列分析。我可以让 R 使用类似于以下的代码生成数据中最常见的 10 个序列的图:
library(TraMineR)
##Loading the data
data(actcal)
##Creating the labels and defining the sequence object
actcal.lab <- c("> 37 hours", "19-36 hours", "1-18 hours", "no work")
actcal.seq <- seqdef(actcal, 13:24, labels=actcal.lab)
## 10 most frequent sequences in the data
actcal.freq <- seqtab(actcal.seq)
actcal.freq
## Plotting the object
seqfplot(actcal.seq, pbarw=FALSE, yaxis="pct", tlim=10:1, cex.legend=.75, withlegend="right")
但是,我还希望在图的右侧有每个序列的频率(在对象 actcal.freq 中)。例如,由上面的代码创建的图中的第一个序列代表 37.9% 的数据(如当前图所示)。根据seqtab
,这是 757 个科目。我希望数字 757 出现在右侧 y 轴上(其他序列以此类推)。
这可能吗?我玩过axis(side=4, ...)
但从未能够让它重现左 y 轴的间距。