[R] Delete NA from a dist object

Gabor Grothendieck ggrothendieck at gmail.com
Thu Jun 5 19:47:24 CEST 2008


Try this:

d <- dist(USArrests)
ix <- which("Iowa" == labels(d))
d1 <- as.dist(as.matrix(d)[-ix, -ix])


On Thu, Jun 5, 2008 at 9:39 AM, Birgitle <birgit.lemcke at systbot.uzh.ch> wrote:
>
> I have a dist object containing 1 row that is only NA (not very intelligent
> to have bas dataset with one NA species....anyway).
> I would like to delete this row from this object.
>
> It may be not a difficult problem but I can not find a solution presently.
>
> So I would be very happy if somebody could give ma a hint
>
> Thanks
>
> B.
>
> -----
> The art of living is more like wrestling than dancing.
> (Marcus Aurelius)
> --
> View this message in context: http://www.nabble.com/Delete-NA-from-a-dist-object-tp17670016p17670016.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list