<div dir="ltr">Dear Jeremy,<div>That should work if you change 3 things :</div><div>- the first problem is your stats object, which is a character vector, not a list of objects, you can't plot a character string.</div><div>- the second problem is the "x" in the plot function. If i is a component and not an attribute of stats, you can't index stats with i.</div><div>- the third smaller problem is that you have to ask R to print two plots. If it is only for visualization, you can use the mfrow argument in the par() function.</div><div><br></div><div>After having created the two objects you want to plot, this code should work :</div><div><p class="gmail-m_6006289437679071460gmail-p1">stats<span class="gmail-m_6006289437679071460gmail-s1"> </span><span class="gmail-m_6006289437679071460gmail-s2"><-</span><span class="gmail-m_6006289437679071460gmail-s1"> </span><span class="gmail-m_6006289437679071460gmail-s2">list(</span>pamomf2i5q.w<span class="gmail-m_6006289437679071460gmail-s2">,</span><span class="gmail-m_6006289437679071460gmail-s3"> </span>pamwardomf2i5q.w<span class="gmail-m_6006289437679071460gmail-s2">)</span></p><p class="gmail-m_6006289437679071460gmail-p2">par(<span class="gmail-m_6006289437679071460gmail-s4">mfrow</span>=c(<span class="gmail-m_6006289437679071460gmail-s5">1</span>,<span class="gmail-m_6006289437679071460gmail-s5">2</span>))</p><p class="gmail-m_6006289437679071460gmail-p1"><span class="gmail-m_6006289437679071460gmail-s6">for</span><span class="gmail-m_6006289437679071460gmail-s1"> </span><span class="gmail-m_6006289437679071460gmail-s2">(</span>i<span class="gmail-m_6006289437679071460gmail-s1"> </span><span class="gmail-m_6006289437679071460gmail-s6">in</span><span class="gmail-m_6006289437679071460gmail-s1"> </span>stats<span class="gmail-m_6006289437679071460gmail-s2">)</span><span class="gmail-m_6006289437679071460gmail-s1"> </span><span class="gmail-m_6006289437679071460gmail-s2">{</span></p><p class="gmail-m_6006289437679071460gmail-p3"><span class="gmail-m_6006289437679071460gmail-s2">  plot(</span><span class="gmail-m_6006289437679071460gmail-s4">i</span><span class="gmail-m_6006289437679071460gmail-s2">,</span><span class="gmail-m_6006289437679071460gmail-s1"> </span><span class="gmail-m_6006289437679071460gmail-s4">stat</span><span class="gmail-m_6006289437679071460gmail-s2">=c(</span>"ASW"<span class="gmail-m_6006289437679071460gmail-s2">,</span>"HC"<span class="gmail-m_6006289437679071460gmail-s2">,</span><span class="gmail-m_6006289437679071460gmail-s1"> </span>"R2"<span class="gmail-m_6006289437679071460gmail-s2">,</span><span class="gmail-m_6006289437679071460gmail-s1"> </span>"PBC"<span class="gmail-m_6006289437679071460gmail-s2">,</span><span class="gmail-m_6006289437679071460gmail-s1"> </span>"HG"<span class="gmail-m_6006289437679071460gmail-s2">),</span><span class="gmail-m_6006289437679071460gmail-s1"> </span><span class="gmail-m_6006289437679071460gmail-s4">legendpos</span><span class="gmail-m_6006289437679071460gmail-s2">=</span>"topright"<span class="gmail-m_6006289437679071460gmail-s2">,</span><span class="gmail-m_6006289437679071460gmail-s1"> </span><span class="gmail-m_6006289437679071460gmail-s4">norm</span><span class="gmail-m_6006289437679071460gmail-s2">=</span>"zscore"<span class="gmail-m_6006289437679071460gmail-s2">)</span></p><p class="gmail-m_6006289437679071460gmail-p1"></p><p class="gmail-m_6006289437679071460gmail-p1"> <span class="gmail-m_6006289437679071460gmail-s2">}</span></p></div><div>Best,</div><div>thomas</div><div class="gmail_extra"><br><div class="gmail_quote">2016-10-08 4:41 GMT+02:00 Reynolds, Jeremy E <span dir="ltr"><<a href="mailto:reyno113@purdue.edu" target="_blank">reyno113@purdue.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_7376358845643935901WordSection1">
<p class="MsoNormal">Dear TraMineR Users,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I would like to loop through many sets of clustering results produced with wcKMedRange and produce a plot for each one.  Without the loop, the code would look like this:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">plot(pamomf2i5q.w, stat=c("ASWw","HC", "R2", "PBC", "HG"), legendpos="topright", norm="zscore")<u></u><u></u></p>
<p class="MsoNormal">plot(pamwardomf2i5q.w, stat=c("ASWw","HC", "R2", "PBC", "HG"), legendpos="topright", norm="zscore")<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">When I try to put this in a loop, I get the error messages below suggesting that R is expecting a y value in the plot command.  Is there something wrong with my loop that is causing this problem?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Jeremy<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="line-height:11.25pt;background:white;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:blue">> stats <- c("pamomf2i5q.w", "pamwardomf2i5q.w")<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:11.25pt;background:white;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:blue">> for (i in unique(stats)) {<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:11.25pt;background:white;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:blue">+   plot(stats[i], stat=c("ASW","HC", "R2", "PBC", "HG"), legendpos="topright", norm="zscore")<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:11.25pt;background:white;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:blue">+ }<u></u><u></u></span></p>
<p class="MsoNormal" style="background:#e5e5e5;word-break:break-all">
<u></u><img width="9" height="9" style="width:.0937in;height:.0937in" src="cid:image001.png@01D220EB.E0518D10" alt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAKUlEQVR42mNgQAKi65/9Z8AHQApgmKACrAqxKcBpIkHryFJEstsYiAUAKIxac8kmY3AAAAAASUVORK5CYII="><u></u><span style="font-size:10.0pt;font-family:"Lucida Console";color:black">
 Show Traceback<u></u><u></u></span></p>
<p class="MsoNormal" style="background:#e5e5e5;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:#e5e5e5;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:black"> Rerun with Debug<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:11.25pt;background:#e5e5e5;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:11.25pt;background:#e5e5e5;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b">Error in plot.window(...) : need finite 'ylim' values<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:11.25pt;background:#e5e5e5;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:black"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:11.25pt;background:white;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b">In addition: Warning messages:<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:11.25pt;background:white;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b">1: In min(x) : no non-missing arguments to min; returning Inf<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:11.25pt;background:white;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b">2: In max(x) : no non-missing arguments to max; returning -Inf<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:11.25pt;background:white;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b">3: In plot.window(...) : "stat" is not a graphical parameter<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:11.25pt;background:white;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b">4: In plot.window(...) : "legendpos" is not a graphical parameter<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:11.25pt;background:white;word-break:break-all">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b">5: In plot.window(...) : "norm" is not a graphical parameter</span><span style="font-size:10.0pt;font-family:"Lucida Console";color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

<br>______________________________<wbr>_________________<br>
Traminer-users mailing list<br>
<a href="mailto:Traminer-users@lists.r-forge.r-project.org">Traminer-users@lists.r-forge.<wbr>r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/traminer-users" rel="noreferrer" target="_blank">https://lists.r-forge.r-<wbr>project.org/cgi-bin/mailman/<wbr>listinfo/traminer-users</a><br></blockquote></div><br></div></div>