我正在运行下面的代码来生成一个TraMineR序列对象的列表。在这里可以找到数据集。
library(TraMineR)
sequences <- read.csv(file = "event-stream-20-l-m.csv", header = TRUE, nrows=10)
repo_names = colnames(sequences)
# 1. Loop across and define the 24 sequence objects & store them in sequence_objects
colpicks <- seq(10,240,by=10)
sequence_objects <- mapply(function(start,stop) seqdef(sequences[,start:stop]),
colpicks - 9, colpicks)但是,如果我跑:
test <- sequence_objects[1]
seqdist(test, indel=1, with.missing=FALSE, norm="maxdist")我收到的错误消息是:
Error: [!] data is not a state sequence object, use 'seqdef' function to create one为什么使用mapply的seqdef不创建序列对象的列表?
发布于 2013-04-06 03:53:14
默认情况下,mapply简化了返回值。
按照前面问题中的注释,尝试将SIMPLIFY=FALSE包含在mapply调用中。
https://stackoverflow.com/questions/15845767
复制相似问题