[adegenet-forum] Between group PCA with genlight object

Valeria Montano mirainoshojo at gmail.com
Mon Jan 14 20:56:29 CET 2013


Hey Sara

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)

that would be

mydf<-do.call(rbind, lapply(genlight at gen, as.integer))
mygenind<-df2genind(mydf, ...., missing=''mean")

Ciao

Valeria

On 14 January 2013 13:52, Thiho Jules <thjnant at gmail.com> wrote:

>  Hello,
>
> 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.
>
> I have received this code from Valeria to replace the missing values with
> 0:
>
> mydf<-lapply(your_genlight at gen, as.integer)
> myrepl<-do.call(rbind, lapply(mydf, function(e) replace(e, is.na(e), 0)))
> dudi.pca(myrepl)
>
> 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.
>
> Thank you very much in advance,
> Best,
> Sara
>
>
> _______________________________________________
> adegenet-forum mailing list
> adegenet-forum at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20130114/64d52c23/attachment.html>


More information about the adegenet-forum mailing list