<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi there,
<br>
<br>
sorry I did not go into the details, but checking for potential mistakes:<br>
<br>
#1<br>
'na.action' is not an argument in find.clusters<br>
<br>
#2<br>
<span dir="ltr">
<pre style="background-color:#EEEEEE;margin-top:0;margin-bottom:14pt;padding:5px;border-width:0;"><font face="Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif" color="#393318" size="1"><span style="font-size:13px;background-color:#EEEEEE;"><font face="Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif" color="black" size="-1">x</font><font face="Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif" color="black" size="-1"><-Just.V4</font><font face="Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif" color="black" size="-1">[</font><font face="Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif" color="maroon" size="-1">2</font><font face="Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif" color="black" size="-1">:</font><font face="Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif" color="maroon" size="-1">13</font><font face="Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif" color="black" size="-1">]</font><font face="Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif" color="black" size="-1"> <br></font></span></font></pre>
</span>
<div>this looks like a vector to me, not a matrix/data.frame; I am not quite sure what you expect 'grp' to be then.<br>
<br>
As for producing scatterplots with varying factors, see argument 'grp' in ?scatter.dapc<br>
<div style="font-family:Tahoma; font-size:13px">
<div class="BodyFragment"><font size="2"><span style="font-size:10pt">
<div class="PlainText"> <br>
Cheers<br>
Thibaut<br>
==============================<br>
Dr Thibaut Jombart<br>
MRC Centre for Outbreak Analysis and Modelling<br>
Department of Infectious Disease Epidemiology<br>
Imperial College - School of Public Health<br>
Norfolk Place, London W2 1PG, UK<br>
Tel. : 0044 (0)20 7594 3658<br>
http://sites.google.com/site/thibautjombart/<br>
http://sites.google.com/site/therepiproject/<br>
http://adegenet.r-forge.r-project.org/<br>
Twitter: @thibautjombart<br>
<br>
<br>
</div>
</span></font></div>
</div>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF300448"><font face="Tahoma" color="#000000" size="2"><b>From:</b> adegenet-forum-bounces@lists.r-forge.r-project.org [adegenet-forum-bounces@lists.r-forge.r-project.org] on behalf of Kirsty Medcalf [kirsty.m.medcalf@gmail.com]<br>
<b>Sent:</b> 23 September 2015 05:45<br>
<b>To:</b> adegenet-forum@lists.r-forge.r-project.org<br>
<b>Subject:</b> [adegenet-forum] DAPC<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr"><br clear="all">
<div>
<div class="gmail_signature">
<div><font size="4"><span style="font-family:verdana,sans-serif">Dear Forum</span><font face="verdana, sans-serif"><br>
</font></font></div>
<div><span style="font-family:verdana,sans-serif"><font size="4"><br>
</font></span></div>
<div><font face="verdana, sans-serif" size="4">This is my first post, so I would like to thank you for your patience. <span style="line-height:19.5px"> The multivariate data that I am using contains two categorical grouping factors (V4 or G8) under the column
family (response variable) and 12 accompanying predictor variables. The data is called LDA.scores and is found at the bottom of my Stack Overflow page by following the link below, which shows my attempted step-by-step logic and figures.</span></font></div>
<div><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:15px; line-height:19.5px"><br>
</span></div>
<div><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:15px; line-height:19.5px"><a href="http://stackoverflow.com/questions/32704902/discriminant-analysis-of-principal-components-and-how-to-graphically-show-the-di" target="_blank">http://stackoverflow.com/questions/32704902/discriminant-analysis-of-principal-components-and-how-to-graphically-show-the-di</a><br>
</span></div>
<div><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:15px; line-height:19.5px"><br>
</span></div>
<div><font face="verdana, sans-serif" size="4"><span style="line-height:19.5px">I have been attempting to graphically show the distance of data points to its multivariate centroid using DAPC analysis and the function `scatter' in the `adegenet' package in R. </span><span style="line-height:19.5px">After
splitting the two categorical factors into two separate data frames (coding below), I attempt to produce these scatterplot. I understand this package is used for the analysis of genetic markers, however, I am also under the impression that all types of multivariate
data can be analysed using this package. I tried to manipulate the data but to no avail.</span></font></div>
<div><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:15px; line-height:19.5px"><br>
</span></div>
<h1 style="margin:0px 0px 1em; padding:0px; border:0px; font-size:21px; line-height:1.3; word-wrap:break-word; font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">
Code used to produce figure</h1>
<div>*Split the dataframe into just V4 and G8</div>
<div><br>
</div>
<div>
<div>Just.V4<-LDA.scores[LDA.scores$Family=="V4",]</div>
<div>Just.G8 <-LDA.scores[LDA.scores$Family=="G8",]<br>
</div>
<div><br>
</div>
</div>
<pre class="" style="margin-top:0px; padding:5px; border:0px; font-size:13px; 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,sans-serif; color:rgb(57,51,24); word-wrap:normal; background-color:rgb(238,238,238)"><code style="margin:0px; padding:0px; border:0px; font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit"><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(128,128,128)">#Attempt to produce a scatterplot for the categorical factor V4 </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">
library</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">(</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">adegenet</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">)</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">
x</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"><-Just.V4</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">[</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(128,0,0)">2</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">:</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(128,0,0)">13</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">]</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> </span></code></pre>
<div><font face="Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, sans-serif" color="#000000"><span style="background-color:rgb(238,238,238)">*Find the clusters</span></font></div>
<div><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)"><br>
</span></div>
<div><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)">grp</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)"><-</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)">find.clusters</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)">(</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)">x</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)">,</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)">
max.n.clust</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)">=</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(128,0,0); background-color:rgb(238,238,238)">12</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)">,</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)">
na.action</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)">=</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(128,0,0); background-color:rgb(238,238,238)">"omit"</span><span class="" style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit; font-size:13px; margin:0px; padding:0px; border:0px; color:rgb(0,0,0); background-color:rgb(238,238,238)">)</span><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:15px; line-height:19.5px"> </span></div>
<div><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:15px; line-height:19.5px"><br>
</span></div>
<div>
<h1 style="margin:0px 0px 1em; padding:0px; border:0px; font-size:21px; line-height:1.3; word-wrap:break-word; font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">
The next step is the perform the discriminant analysis of principal components</h1>
<pre class="" style="margin-top:0px; padding:5px; border:0px; font-size:13px; 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,sans-serif; color:rgb(57,51,24); word-wrap:normal; background-color:rgb(238,238,238)"><code style="margin:0px; padding:0px; border:0px; font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit"><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> dapc1</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"><-</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">dapc</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">(</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">x</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">,</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> grp</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">$</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">grp</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">)</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">
scatter</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">(</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">dapc1</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">)</span></code></pre>
<h1 style="margin:0px 0px 1em; padding:0px; border:0px; font-size:21px; line-height:1.3; word-wrap:break-word; font-family:'Helvetica Neue',Helvetica,Arial,sans-serif">
I have tried many different combinations of code and here are some of the error messages</h1>
<pre class="" style="margin-top:0px; padding:5px; border:0px; font-size:13px; 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,sans-serif; color:rgb(57,51,24); word-wrap:normal; background-color:rgb(238,238,238)"><code style="margin:0px; padding:0px; border:0px; font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit"><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">Error </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,139)">in</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> dapc.data.frame</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">(</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">x</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">,</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> grp1</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">$</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">grp1</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">)</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">:</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> Inconsistent length </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,139)">for</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> grp
Warning </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,139)">in</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> find.clusters.data.frame</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">(</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">as.data.frame</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">(</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">x</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">),</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(128,0,0)">...</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">)</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">:</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">
NAs introduced by coercion
Error </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,139)">in</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,139)">if</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">(</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">n.pca </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">>=</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> N</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">)</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> warning</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">(</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(128,0,0)">"number of retained PCs of PCA is greater than N"</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">)</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">:</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">
missing value where </span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(128,0,0)">TRUE</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)">/</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(128,0,0)">FALSE</span><span class="" style="margin:0px; padding:0px; border:0px; color:rgb(0,0,0)"> needed</span></code></pre>
</div>
<div><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:15px; line-height:19.5px"><br>
</span></div>
<div><span style="font-size:15px; line-height:19.5px"><font face="verdana, sans-serif">If anyone has a solution in terms of how to produce two figures for each categorical factor which illustrates the clusters (12 parameters measured) to its multivariate centroid,
then thank so much. I have followed lots of tutorials, searched online and read papers, and still do not understand these error and warning messages. </font></span></div>
<div><span style="font-size:15px; line-height:19.5px"><font face="verdana, sans-serif"><br>
</font></span></div>
<div><span style="font-size:15px; line-height:19.5px"><font face="verdana, sans-serif">Thank you if anyone can help.</font></span></div>
<div><span style="font-size:15px; line-height:19.5px"><font face="verdana, sans-serif"><br>
</font></span></div>
<div><span style="font-size:15px; line-height:19.5px"><font face="verdana, sans-serif">Best wishes,</font></span></div>
<div><span style="font-size:15px; line-height:19.5px"><font face="verdana, sans-serif">Kaikash</font></span></div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>