<html><body><div style="font-family: trebuchet ms,sans-serif; font-size: 12pt; color: #000000"><div><span style="font-family: 'trebuchet ms', sans-serif;">Hi Maïlis,</span></div><div><span style="font-family: 'trebuchet ms', sans-serif;"><br></span></div><div><span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;"><span style="font-family: 'trebuchet ms', sans-serif;">in xvalDapc</span> `x` argument is your DAPC result (`tab(dapc1)`) and `grp` is the membership of individuals in groups. The latter is sometimes found in // Optional content, but you appear to not have this. You will have to assign indviduals to a population some other way. You tried using `find.clusters` and you can access group membership by taking out a $grp element. In your case that would be</span></div><div><span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;"><br></span></div><div><span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;">    <span style="font-family: 'courier new', courier, monaco, monospace, sans-serif;">xvalDapc(tab(dapc1), grp = grp$grp)</span></span></div><div><span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;"><br></span></div><div><span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;">I omitted `x =` which is personal preference of always omitting first argument in a function call.</span></div><div><span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;">Let us know if this works.</span></div><div><span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;"><br></span></div><div><span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;">Cheers,</span></div><div><span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;">Roman</span></div><div><span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;"><br></span></div><div><span name="x"></span>----<br>In god we trust, all others bring data.<span name="x"></span><br></div><div><br></div><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>From: </b>"Maïlis" <mailis@kwata.net><br><b>To: </b>adegenet-forum@lists.r-forge.r-project.org<br><b>Sent: </b>Tuesday, January 26, 2016 12:01:31 PM<br><b>Subject: </b>[adegenet-forum] xvalDapc, help for arguments "x" and "grp"<br><div><br></div>
  

    
  
  
    Hello, <br>
    <br>
    <div style="" id="gt-input-tool">
      <div><span class="ita-kd-inputtools-div"></span></div>
    </div>
    <div id="gt-src-c" class="g-unit">
      <div id="gt-src-p"> </div>
    </div>
    <div id="gt-res-content" class="almost_half_cell">
      <div dir="ltr" style="zoom:1">
        <div id="tts_button"></div>
        <div style="" id="gt-input-tool">
          <div><span class="ita-kd-inputtools-div"></span></div>
        </div>
        <div id="gt-src-c" class="g-unit">
          <div id="gt-src-p"> </div>
        </div>
        <div id="gt-res-content" class="almost_half_cell">
          <div dir="ltr" style="zoom:1">
            <div id="tts_button"></div>
            <span id="result_box" class="" lang="en"><span class="hps">I
                am contacting</span> <span class="hps">you because</span>
              <span class="hps">I use the</span> <span class="hps">DAPC
                fonction</span> <span class="hps">of adegenet</span>
              package <span class="hps">without encountering</span> <span class="hps">any particular problems.</span> <span class="hps">However</span><span>, I would</span> <span class="hps">like</span> <span class="hps">to use the</span>
              <span class="hps">cross</span> <span class="hps">validation,</span>
              <span class="hps">and that</span><span>'s when</span> <span class="hps">it</span> <span class="hps">no longer
                works..</span></span></div>
        </div>
      </div>
    </div>
    <br>
    <small><i>>
        database<-read.table(file.choose("C:/Users/.../XXX.txt"),
        header=TRUE, sep=",",na.strings="-9")</i><i><br>
      </i><i>> x<- df2genind(data.frame(database), sep="/",
        ncode=3, p=NULL, NA.char="-9", ploidy=2,
        type=c("codom"),strata=NULL, hierarchy=NULL)</i><i><br>
      </i><i>/// GENIND OBJECT /////////</i><i><br>
      </i><i><br>
      </i><i> // 341 individuals; 7 loci; 164 alleles; size: 264.9 Kb</i><i><br>
      </i><i><br>
      </i><i> // Basic content</i><i><br>
      </i><i>   @tab:  341 x 164 matrix of allele counts</i><i><br>
      </i><i>   @loc.n.all: number of alleles per locus (range: 13-30)</i><i><br>
      </i><i>   @loc.fac: locus factor for the 164 columns of @tab</i><i><br>
      </i><i>   @all.names: list of allele names for each locus</i><i><br>
      </i><i>   @ploidy: ploidy of each individual  (range: 2-2)</i><i><br>
      </i><i>   @type:  codom</i><i><br>
      </i><i>   @call: df2genind(X = data.frame(database), sep = "/",
        ncode = 3, pop = NULL, </i><i><br>
      </i><i>    NA.char = "-9", ploidy = 2, type = c("codom"), strata =
        NULL, </i><i><br>
      </i><i>    hierarchy = NULL)</i><i><br>
      </i><i><br>
      </i><i> // Optional content</i><i><br>
      </i><i>   - empty -</i><i><br>
      </i><i>Warning message:</i><i><br>
      </i><i>In df2genind(data.frame(database), sep = "/", ncode = 3, p
        = NULL,  :</i><i><br>
      </i><i>  duplicate labels detected for some individuals; using
        generic labels</i><i><br>
      </i><i><br>
      </i><i>> grp<-find.clusters(x, max.n.clust=9)</i><i><br>
      </i><i>Choose the number PCs to retain (>=1): 140</i><i><br>
      </i><i>Choose the number of clusters (>=2): 6</i><i><br>
      </i><i>> dapc1<-dapc(x,grp$grp)</i><i><br>
      </i><i>Choose the number PCs to retain (>=1): 40</i><i><br>
      </i><i>Choose the number discriminant functions to retain
        (>=1): 5</i></small><br>
    <br>
    It works but, for using xvalDapc
    <div id="gt-res-content" class="almost_half_cell">
      <div dir="ltr" style="zoom:1"><span id="result_box" class="" lang="en"><span class="hps">I don't know</span> <span class="hps">what to choose</span> <span class="hps">as an
            argument</span> <span class="hps atn">for "</span><span class="atn">x" and "</span><span>grp</span><span>". I tried
            severals things but that didn't work. <br>
          </span></span><span id="result_box" class="" lang="en"><span><span id="result_box" class="short_text" lang="en"><span class="hps">Can</span> <span class="hps">you advise me</span>
              <span class="hps">on the arguments</span> <span class="hps">to use?<br>
                <br>
              </span></span></span></span><br>
        <span id="result_box" class="" lang="en"><span><span id="result_box" class="short_text" lang="en"><span class="hps"><span id="result_box" class="short_text" lang="en"><span class="hps">Thank</span> <span class="hps">you in advance for</span> <span class="hps">your reply, <br>
                    <br>
                    Best regards, <br>
                    <br>
                    Maïlis<br>
                  </span></span><br>
              </span></span></span></span></div>
    </div>
  
<table style="border-top: 1px solid #aaabb6; margin-top: 30px;" class="mceItemTable">
        <tbody><tr>
                <td style="width: 105px; padding-top: 15px;">
                        <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img style="width: 90px; height:33px;" src="https://ipmcdn.avast.com/images/logo-avast-v1.png"></a>
                </td>
                <td style="width: 470px; padding-top: 20px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Cet e-mail a été envoyé depuis un ordinateur protégé par Avast. <br><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>            </td>
        </tr>
</tbody></table>


<br>_______________________________________________<br>adegenet-forum mailing list<br>adegenet-forum@lists.r-forge.r-project.org<br>https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum</div><div><br></div></div></body></html>