Hey Sara <div><br></div><div>if you want to you can convert the genlight into genind and directly replace the missing values with the option missing='mean' (I had not thought about this solution)<div><br></div><div>
that would be </div><div><br></div><div><div>mydf<-do.call(rbind, lapply(genlight@gen, as.integer))</div></div><div>mygenind<-df2genind(mydf, ...., missing=''mean")</div><div><br></div><div>Ciao</div><div>
<br></div><div>Valeria</div><div><br></div><div><div class="gmail_quote">On 14 January 2013 13:52, Thiho Jules <span dir="ltr"><<a href="mailto:thjnant@gmail.com" target="_blank">thjnant@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
Hello,<br>
<br>
I have a genlight object (the genlight object has been created with
plink.raw file using the command "recodeA", I want to use the
functions "dudi.pca" and "bca" to perform a between group PCA.<br>
<br>
I have received this code from Valeria to replace the missing values
with 0:<br>
<br>
<div>mydf<-lapply(your_genlight@gen, as.integer)</div>
<div>myrepl<-do.call(rbind, lapply(mydf, function(e) replace(e, <a href="http://is.na" target="_blank">is.na</a>(e), 0)))</div>
<div>dudi.pca(myrepl)<br>
<br>
This code indeed works and I can perform dudi.pca and bca, but I
was wondering whether this is correct to replace the missing
values with 0 as zero itself exists in the plink.raw for the
markers with no second allele. <br>
<br>
Thank you very much in advance,<br>
Best,<br>
Sara<br>
</div>
<br>
</div>
<br>_______________________________________________<br>
adegenet-forum mailing list<br>
<a href="mailto:adegenet-forum@lists.r-forge.r-project.org">adegenet-forum@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum</a><br></blockquote></div><br></div></div>