[Traminer-users] Format of sequences

Gilbert Ritschard Gilbert.Ritschard at unige.ch
Thu Jun 11 08:57:12 CEST 2015


You could also consider the HSPELL_to_STS function provided by the TraMineRextras package.


From: traminer-users-bounces at lists.r-forge.r-project.org [mailto:traminer-users-bounces at lists.r-forge.r-project.org] On Behalf Of Hadrien Commenges
Sent: Thursday, June 11, 2015 08:45
To: Users questions
Subject: Re: [Traminer-users] Format of sequences

You could also split your table by set of columns (columns 1:4, then col c(1, 5:7), etc.) and then rbind() all the tables.

Another option would be the melt() function in the reshape2 package.

________________________________
De: "thomas collas" <thomas.collas at gmail.com<mailto:thomas.collas at gmail.com>>
À: "Users questions" <traminer-users at lists.r-forge.r-project.org<mailto:traminer-users at lists.r-forge.r-project.org>>
Envoyé: Mercredi 10 Juin 2015 21:03:05
Objet: Re: [Traminer-users] Format of sequences

Addendum : Do not forget to keep the ID column with the three other columns at each iteration.

2015-06-10 21:01 GMT+02:00 thomas collas <thomas.collas at gmail.com<mailto:thomas.collas at gmail.com>>:

Hello Anton,
An easy solution is to build a very short loop (I know R is not made for loops but it's only 18 iterations) separating each group of  three columns, turning the headings into common ones (begin/end/state) and pasting each one below the other.
I hope that helps,
thomas collas

2015-06-10 18:51 GMT+02:00 Anton Perdoncin <anton.perdoncin at gmail.com<mailto:anton.perdoncin at gmail.com>>:

Hi,

I have sequences in the following format :

ID    BEGIN1        END1            STATE1        BEGIN2        END2
   STATE2  etc... until 18
1   01/01/1950  01/01/1960          X         02/01/1960   30/01/1960
   Y    ...
2   01/01/1950  01/01/1960          X         02/01/1960   30/01/1960
   Y    ...

One line = one individual. Successive episodes = successive columns.

I know that I need to convert dates into numbers: no problem with that.

However, does anyone have any idea on how I could convert such a df into
an STS or SPELL format ?

Thanks!

Best regards,

Anton Perdoncin
_______________________________________________
Traminer-users mailing list
Traminer-users at lists.r-forge.r-project.org<mailto:Traminer-users at lists.r-forge.r-project.org>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users



_______________________________________________
Traminer-users mailing list
Traminer-users at lists.r-forge.r-project.org<mailto:Traminer-users at lists.r-forge.r-project.org>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20150611/c52d2d7c/attachment.html>


More information about the Traminer-users mailing list