[Traminer-users] Error message with SPELL, R hangs with TSE

Gilbert Ritschard Gilbert.Ritschard at unige.ch
Mon Apr 9 20:46:27 CEST 2012


Dear Camillia,

It is not clear to me what your StepNumber is. Does it stand for states? 
How many different values does it take?

Any way. I think you are better to first transform your spell data into 
STS format with the seqformat() function, and then define your state 
sequence object from the STS data. You will have to specify whether you 
want to align your sequences on calendar time (default) or a process 
time (time since a individual start event).

Currently, the seqformat function of TraMineR does not support date or 
time format for the "begin" and "end" arguments. You should first 
transform those start and end times into integers, so that they can be 
interpreted as positions in the sequence.

For your attempt to use the methods for  event sequences, again, I am 
not sure what your StepNumber stands for. You use it as if it defined 
the event occurring at the time stamp. Is that what you want to do?

Gilbert





On 07-Apr-12 21:24, Camillia Matuk wrote:
> Hello,
>
> I'm having problems getting started with my data, and am very new to 
> both R and to TraMineR. I hope someone can help.
>
> Relevant columns in my csv file are WorkgroupID (e.g., 65472), Start 
> and Stop times (e.g., 11/28/11 9:37 AM), and StepNumber (e.g., "4.5").
>
> After reading in my data, this is what I did:
>
> > WorkgroupID_factor <- factor(d$WorkgroupID)
> > StepNumber_factor <- factor(d$StepNumber)
> > d <- data.frame(d, WorkgroupID_factor, StepNumber_factor)
>
> I figured I should treat this as SPELL formatted data, so I did this:
>
> > d.labels <- seqstatl(d$StepNumber_factor)
> > d.states <- 1:length(d.labels)
>
> But I get error messages when I do this:
> > d.seq <- seqdef(d, var = c("WorkgroupID_factor", "StartTime", 
> "StopTime", "StepNumber_factor"), informat = "SPELL", states = 
> d.states, labels = d.labels, process = FALSE)
>
> Error in Summary.factor(c(NA_integer_, NA_integer_, NA_integer_, 
> NA_integer_,  :
>   min not meaningful for factors
> In addition: Warning messages:
> 1: In Ops.factor(begincolumn, 1) : < not meaningful for factors
> 2: In Ops.factor(endcolumn, begincolumn) : - not meaningful for factors
> 3: In Ops.factor(begincolumn, 0) : > not meaningful for factors
>
> Abandoning that, I then tried treating my data as though it were in 
> TSE format. I'm not sure if that's proper thing to do...
> d.seqe <- seqecreate(id = d$WorkgroupID_factor, timestamp = 
> d$StartTime, event = d$StepNumber_factor)
>
> This works, although I'm still unsure about how to read it:
> > print(d.seqe[2]) #Displays the sequence of events
> [1] 
> 67.00-(1.1)-2.00-(1.2)-3.00-(1.3)-3.00-(1.4)-2.00-(1.5)-2.00-(1.4)-3.00-(1.5,1.5,1.6)-198.00-(1.6)-1.00-(1.5,1.5,1.6)-1.00-(1.4,1.4,1.5)-2.00-(2.1,2.3)-4.00-(2.3,2.3)-1.00-(2.3,2.3,2.3,2.4)-1.00-(2.3,2.3,2.4)-3.00-(2.3,2.3)-3.00-(2.3)-7.00-(2.3,2.4)-9.00-(2.3,2.4,2.4)-167.00-(2.4,2.4,2.5,2.6)-(...)
>
> But when I run this command, R hangs and I have to force quit and restart:
> d.fsubseq <- seqefsub(d.seqe, minSupport = 50)
>
>
> I hope someone can point out what I'm doing wrong. Thanks for any 
> assistance!
>
> -- 
> Camillia
>
> http://sites.google.com/site/cfmatuk/
>
>
> _______________________________________________
> Traminer-users mailing list
> Traminer-users at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users

-- 
Gilbert Ritschard, Department of Economics and
Institute for Demographic and Life Course Studies,
University of Geneva, 40, bd du Pont-d'Arve, CH-1211 Genève 4, Switzerland
http://mephisto.unige.ch



More information about the Traminer-users mailing list