[Traminer-users] Format of sequences
Hadrien Commenges
hc at parisgeo.cnrs.fr
Thu Jun 11 08:45:06 CEST 2015
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.
----- Mail original -----
De: "thomas collas" <thomas.collas at gmail.com>
À: "Users questions" <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 > :
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 > :
<blockquote>
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
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users
</blockquote>
_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20150611/ba39ca05/attachment.html>
More information about the Traminer-users
mailing list