<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hello Dr. Neel,</div><div class=""><br class=""></div><div class="">You can use an anonymous function. I.E: other.action = function(x){ mean(x, na.rm = TRUE) }</div><div class=""><br class=""></div><div class="">Hope that helps!</div><div class="">Zhian</div><div class=""><br class=""></div><div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">-----</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Zhian N. Kamvar, Ph. D.</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Postdoctoral Researcher (Everhart Lab)</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Department of Plant Pathology</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">University of Nebraska-Lincoln</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">ORCID: 0000-0003-1458-7108</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline">
</div>
<div><blockquote type="cite" class=""><div class=""><div class=""><br class="">Date: Sat, 4 Nov 2017 17:35:31 -0400<br class="">From: Maile C Neel <<a href="mailto:mneel@umd.edu" class="">mneel@umd.edu</a>><br class="">To: <a href="mailto:adegenet-forum@lists.r-forge.r-project.org" class="">adegenet-forum@lists.r-forge.r-project.org</a><br class="">Subject: [adegenet-forum] Handling Missing Spatial Data in<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>genind2genpop<br class="">Message-ID:<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span><<a href="mailto:CAEdnyY=WncVKKWh7cJ3ehg4LeJpRTcxvANt0DD67M3BsR15igA@mail.gmail.com" class="">CAEdnyY=WncVKKWh7cJ3ehg4LeJpRTcxvANt0DD67M3BsR15igA@mail.gmail.com</a>><br class="">Content-Type: text/plain; charset="utf-8"<br class=""><br class="">Apologies if this seemingly simple question has been answered before. I<br class="">have found nothing from extensive searches of manuals and adegenet archives.<br class=""><br class="">In my data set of 1,110+ individuals from 25 sites, a few individuals at 2<br class="">sites lack GPS coordinates. For pairwise comparisons of individuals that<br class="">require coordinates, I eliminate samples with missing location data.<br class=""><br class="">However, when I am collapsing the data set to populations using<br class="">genind2genpop I would like to keep the genetic data from all samples and<br class="">ignore the NA values in the genind@other$utms slot. If even one sample in<br class="">a population is missing utm coordinates, the population values are NA<br class=""><br class="">I want the population centroid returned to the genpop@other$utms slot to be<br class="">the mean of the samples that DO have utm coordinates. The distances among<br class="">populations are so large that any error introduced by a small number of<br class="">missing locations will not affect my results.<br class=""><br class="">I know how to specify a basic function for other.action (e.g.,<br class="">other.action=mean), but I can't see how to specify something like<br class="">na.remove, na.omit, or complete.cases that would calculate the mean<br class="">ignoring missing data.. Another option would be to replace missing<br class="">@other$utms values with mean values for the population based on complete<br class="">cases from within the genind2genpop call, but that also does not appear to<br class="">be possible.<br class=""><br class="">Is there an easy way to keep all my genetic observations and get a<br class="">population centroids ignoring missing coordinates?<br class=""><br class="">____________<br class="">Maile Neel<br class="">Professor; Director of the Norton-Brown Herbarium<br class="">University of Maryland<br class="">Department of Plant Science and Landscape Architecture &<br class="">Department of Entomology<br class="">-------------- next part --------------<br class="">An HTML attachment was scrubbed...<br class="">URL: <<a href="http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171104/ba5dd98c/attachment-0001.html" class="">http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171104/ba5dd98c/attachment-0001.html</a>><br class=""><br class="">------------------------------<br class=""><br class="">_______________________________________________<br class="">adegenet-forum mailing list<br class=""><a href="mailto:adegenet-forum@lists.r-forge.r-project.org" class="">adegenet-forum@lists.r-forge.r-project.org</a><br class="">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum<br class=""><br class="">End of adegenet-forum Digest, Vol 111, Issue 4<br class="">**********************************************<br class=""></div></div></blockquote></div><br class=""></body></html>