<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:20px;background-color:rgba(252,251,248,0.901961)">
Hi All,</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:20px;background-color:rgba(252,251,248,0.901961)">
<br></p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:20px;background-color:rgba(252,251,248,0.901961)">
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:rgb(238,238,238);color:rgb(51,51,51);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:rgb(34,34,34)"><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:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:rgb(43,145,175)">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:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:rgb(43,145,175)">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:0px;border:0px;font-size:15px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:20px;background-color:rgba(252,251,248,0.901961)">
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:rgb(238,238,238);color:rgb(51,51,51);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:rgb(34,34,34)"><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:0px;padding:0px;border:0px;font-size:13px;vertical-align:baseline;color:rgb(0,0,139)">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:0px;border:0px;font-size:15px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:20px;background-color:rgba(252,251,248,0.901961)">
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:rgb(238,238,238);color:rgb(51,51,51);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:rgb(34,34,34)"><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:0px;border:0px;font-size:15px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:20px;background-color:rgba(252,251,248,0.901961)">
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:0px;border:0px;font-size:15px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:20px;background-color:rgba(252,251,248,0.901961)">
Thanks,</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;vertical-align:baseline;clear:both;word-wrap:break-word;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:20px;background-color:rgba(252,251,248,0.901961)">
Michael</p>