[adegenet-forum] Handling Missing Spatial Data in genind2genpop
Zhian Kamvar
zkamvar at gmail.com
Mon Nov 6 16:45:31 CET 2017
Hello Dr. Neel,
You can use an anonymous function. I.E: other.action = function(x){ mean(x, na.rm = TRUE) }
Hope that helps!
Zhian
-----
Zhian N. Kamvar, Ph. D.
Postdoctoral Researcher (Everhart Lab)
Department of Plant Pathology
University of Nebraska-Lincoln
ORCID: 0000-0003-1458-7108
>
> Date: Sat, 4 Nov 2017 17:35:31 -0400
> From: Maile C Neel <mneel at umd.edu>
> To: adegenet-forum at lists.r-forge.r-project.org
> Subject: [adegenet-forum] Handling Missing Spatial Data in
> genind2genpop
> Message-ID:
> <CAEdnyY=WncVKKWh7cJ3ehg4LeJpRTcxvANt0DD67M3BsR15igA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Apologies if this seemingly simple question has been answered before. I
> have found nothing from extensive searches of manuals and adegenet archives.
>
> In my data set of 1,110+ individuals from 25 sites, a few individuals at 2
> sites lack GPS coordinates. For pairwise comparisons of individuals that
> require coordinates, I eliminate samples with missing location data.
>
> However, when I am collapsing the data set to populations using
> genind2genpop I would like to keep the genetic data from all samples and
> ignore the NA values in the genind at other$utms slot. If even one sample in
> a population is missing utm coordinates, the population values are NA
>
> I want the population centroid returned to the genpop at other$utms slot to be
> the mean of the samples that DO have utm coordinates. The distances among
> populations are so large that any error introduced by a small number of
> missing locations will not affect my results.
>
> I know how to specify a basic function for other.action (e.g.,
> other.action=mean), but I can't see how to specify something like
> na.remove, na.omit, or complete.cases that would calculate the mean
> ignoring missing data.. Another option would be to replace missing
> @other$utms values with mean values for the population based on complete
> cases from within the genind2genpop call, but that also does not appear to
> be possible.
>
> Is there an easy way to keep all my genetic observations and get a
> population centroids ignoring missing coordinates?
>
> ____________
> Maile Neel
> Professor; Director of the Norton-Brown Herbarium
> University of Maryland
> Department of Plant Science and Landscape Architecture &
> Department of Entomology
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171104/ba5dd98c/attachment-0001.html>
>
> ------------------------------
>
> _______________________________________________
> 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
>
> End of adegenet-forum Digest, Vol 111, Issue 4
> **********************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171106/9a10f961/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171106/9a10f961/attachment.sig>
More information about the adegenet-forum
mailing list