<div dir="ltr"><div dir="ltr" style="font-size:12.8px"><p class="gmail-m_2292247984011682104gmail-p1">Hi Jeremy,</p><p class="gmail-m_2292247984011682104gmail-p1">I am sorry to read that you are still stuck and I am sorry to answer so late but I have just received your message (probably because of its size). Loops can be tricky.</p><p class="gmail-m_2292247984011682104gmail-p1">If you want to print in the first two loops, you should ask R to do so with the print() function. If you want to handle the results, it can be more convenient to create a list to which you add a component at each iteration.</p><p class="gmail-m_2292247984011682104gmail-p1">In the second loop, you should build a character vector instead of a list of numbers and you can put the "$stats" part after the bracket, since you ask R to get an object which is within another object, the problem comes from the "$" which is an operator, not a part of the object name. Something like that should work :</p><p class="gmail-m_2292247984011682104gmail-p3"><span class="gmail-m_2292247984011682104gmail-s1">indels2</span><span class="gmail-m_2292247984011682104gmail-s2"> </span><span class="gmail-m_2292247984011682104gmail-s3"><-</span><span class="gmail-m_2292247984011682104gmail-s2"> </span><span class="gmail-m_2292247984011682104gmail-s3">c(</span>"1.0"<span class="gmail-m_2292247984011682104gmail-s3">,</span> "1.5"<span class="gmail-m_2292247984011682104gmail-s3">,</span> "2.0"<span class="gmail-m_2292247984011682104gmail-s3">)</span></p><p class="gmail-m_2292247984011682104gmail-p4"><span class="gmail-m_2292247984011682104gmail-s4">for</span><span class="gmail-m_2292247984011682104gmail-s5"> </span><span class="gmail-m_2292247984011682104gmail-s3">(</span>i<span class="gmail-m_2292247984011682104gmail-s5"> </span><span class="gmail-m_2292247984011682104gmail-s4">in</span><span class="gmail-m_2292247984011682104gmail-s5"> </span>indels2<span class="gmail-m_2292247984011682104gmail-s3">){</span></p><p class="gmail-m_2292247984011682104gmail-p5"> print(round(get(paste0(<span class="gmail-m_2292247984011682104gmail-s5">"<wbr>pamclust"</span>,<span class="gmail-m_2292247984011682104gmail-s1">i</span>))$<span class="gmail-m_2292247984011682104gmail-s1">stats</span>[,c(<span class="gmail-m_2292247984011682104gmail-s5">"ASW"</span>,<span class="gmail-m_2292247984011682104gmail-s5"> "HC"</span>,<span class="gmail-m_2292247984011682104gmail-s5"> "R2"</span>,<span class="gmail-m_2292247984011682104gmail-s5"> "PBC"</span>,<span class="gmail-m_2292247984011682104gmail-s5"> "HG"</span>)],<span class="gmail-m_2292247984011682104gmail-s6">3</span>))</p><p class="gmail-m_2292247984011682104gmail-p5">}</p><p class="gmail-m_2292247984011682104gmail-p4">Regarding the third loop, there are two different problems. First, you do not ask R to print several plots, with the layout() function, or the mfrow argument in the par() function or simply by saving a new pdf or jpg file at each iteration. Second, you ask R to name each plot by a matrix, what it does by converting it into a character string. You can create a character vector to index the indels3 list and to name each plot. But be sure first that the objects in your list are named, which is not the case here.</p><p class="gmail-m_2292247984011682104gmail-p6">Hope that still helps.</p><p class="gmail-m_2292247984011682104gmail-p4">best,</p><p class="gmail-m_2292247984011682104gmail-p4">thomas</p></div><div class="gmail-yj6qo gmail-ajU" style="margin:2px 0px 0px;font-size:12.8px"></div><div class="gmail_extra"><br></div></div>