<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000'>Hi Michael,<br><br>I think you don't have to merge your demographic data with your states/events data, it seems to me that it's the source of your problem. For my part, I always work with two objects: the state/event object (sts object) and a dataframe with individual's id and variables. Try to convert your spell data without the status variable (educ4), and to get your individual's data in a separate dataframe. Then you can try :<br><br>seqiplot(data.seq, group = individuals$group, ...)<br><br>Hope it helps.<br><br>Hadrien<br><br><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>De: </b>"Michael Corey" <michael.corey@gmail.com><br><b>À: </b>Traminer-users@lists.r-forge.r-project.org<br><b>Envoyé: </b>Mercredi 19 Septembre 2012 02:17:05<br><b>Objet: </b>[Traminer-users] Problems passing/using group command<br><br><p style="margin:0px 0px 1em;padding:">
Hi All,</p><p style="margin:0px 0px 1em;padding:">
<br></p><p style="margin:0px 0px 1em;padding:">
I'm having a problem using the group function in TraMineR. I have a data set that contains SPELL data, so multiple rows per case. I also have demographic data per case, at one row per case. I merge these together and end up with data that has a demographic covariate per row, so multiple rows per case. An example of this data would be:</p>
<pre class="default prettyprint" style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:15px;vertical-align:baseline;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-color:;line-height:20px"><code style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;color:"><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">id startmin stopmin activity educ4<br>
</span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">4</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> </span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">1</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> </span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">20</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> work HS<br>
</span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">4</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> </span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">20</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> </span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">40</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> play HS<br>
</span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">8</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> </span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">1</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> </span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">15</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> sleep </span><span class="typ" style="margin:">College</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"><br>
</span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">8</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> </span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">15</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> </span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">40</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> work </span><span class="typ" style="margin:">College</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"><br>
</span></code></pre><p style="margin:0px 0px 1em;padding:">
I can make sequence data from this, but when I try to run a plot using the group command</p><pre class="default prettyprint" style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:15px;vertical-align:baseline;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-color:;line-height:20px"><code style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;color:"><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> seqiplot</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">atus</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">seq</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> </span><span class="kwd" style="margin:">group</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> atus</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">seqdata$educ4</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> border</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">NA</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> <br>
withlegend</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">=</span><span class="str" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">"right"</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> cex</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">plot</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">=.</span><span class="lit" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">55</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">)</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"><br>
</span></code></pre><p style="margin:0px 0px 1em;padding:">
it tells me:</p><pre class="default prettyprint" style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:15px;vertical-align:baseline;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-color:;line-height:20px"><code style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;color:"><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"> </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">></span><span class="str" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:maroon">"Error: group must contain one value for each row in the sequence object"</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:black"><br>
</span></code></pre><p style="margin:0px 0px 1em;padding:">
I have gotten this to work with the example of the mvad data in the training manual, but I can't seem to get it to work with the groups, whether I link to the original demographic data, the merged data, or try to pass the covariates by seqformat and seqdef. Ideas?</p>
<p style="margin:0px 0px 1em;padding:">
Thanks,</p><p style="margin:0px 0px 1em;padding:">
Michael</p>
<br>_______________________________________________<br>Traminer-users mailing list<br>Traminer-users@lists.r-forge.r-project.org<br>https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users</div><br></div></body></html>