Using mapply to create sequence objects in R/TraMineR? -
i running code below generate list of traminer sequence objects. dataset can found [here][1].
library(traminer) sequences <- read.csv(file = "event-stream-20-l-m.csv", header = true, nrows=10) repo_names = colnames(sequences) # 1. loop across , define 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) however, if run:
test <- sequence_objects[1] seqdist(test, indel=1, with.missing=false, norm="maxdist") the error message receive is:
error: [!] data not state sequence object, use 'seqdef' function create 1 how can mapply using seqdef not create list of sequence objects?
mapply default simplifies return value.
as per comment in previous question, try including simplify=false in mapply call.
Comments
Post a Comment