[adegenet-forum] Missing values in genlight object

Valeria Montano mirainoshojo at gmail.com
Thu Jan 10 17:43:35 CET 2013


Dear Sara,

you can modify the @gen slot in the genlight object in this way and use it
to run the dudi.pca

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)

I am very much sure there are smarter codes to do it but I tried it on the
flu dataset and it works :p
Hope this helps

Ciao
Valeria

On 10 January 2013 15:05, Thiho Jules <thjnant at gmail.com> wrote:

> Hello,
>
> I have created a genlight object within the package "adegenet". I wanted
> to do between-group PCA which requires that I first use the funtion,
> dudi.pca.
>
> But my genlight object involves "NA" or missing values, therefore, the
> dudi.pca function gives an error. I would like to know how I can remove the
> NA in a genlight object?
>
> I tried na.replace and na.omit but none works, and NA.posi only gives me
> the position of the missing values.
>
> Thank you in advance for your help,
> Best,
> Sara
> ______________________________**_________________
> adegenet-forum mailing list
> adegenet-forum at lists.r-forge.**r-project.org<adegenet-forum at lists.r-forge.r-project.org>
> https://lists.r-forge.r-**project.org/cgi-bin/mailman/**
> listinfo/adegenet-forum<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/20130110/9ba50bb2/attachment.html>


More information about the adegenet-forum mailing list