[adegenet-forum] adegenet package: Monmonier function data export
Thibaut Jombart
jombart at biomserv.univ-lyon1.fr
Tue Nov 25 14:43:38 CET 2008
James Cheshire wrote:
> Dear adegenet users,
>
> When I print the Monmonier object class it only lists the coordinates
> of the the first three points in each run as follows:
>
> $call:monmonier(xy = Coordinates, dist = Dist, cn = nbDelaunay, nrun =
> 20,
> scanthres = TRUE)
>
> # Object content #
> Class: monmonier
> $nrun (number of successive runs): 20
> $run1 ... $run20: runs of the algorithm
> $threshold (minimum difference between neighbours): 0.4003
> $xy: spatial coordinates
> $cn: connection network
>
> # Runs content #
> # Run 1
> # First direction
> Class: list
> $path:
> x y
> Point_1 361546.4 280420.0
> Point_2 376145.2 284840.4
> Point_3 387056.9 281490.3
> ...
>
>
> Is it possible to print or extract all the coordinates used to plot
> the Monmonier boundaries? My reason for doing this is so that I can
> export them into a Geographical Information System software package.
>
> Many thanks for your help in advance, it is greatly appreciated.
>
> James Cheshire
>
> PhD Student
> University College London
>
Hello James,
yes, it is possible (see ?monmonier, "value" section for a description
of monmonier objects). Here is an example:
##
library(adegenet)
load(system.file("files/mondata2.rda",package="adegenet"))
cn2 <- chooseCN(mondata2$xy,type=1,ask=FALSE)
mon2 <- monmonier(mondata2$xy,dist(mondata2$x2),cn2,threshold=2, nrun=3)
plot(mon2,mondata2$x2,method="greylevel",add.arr=FALSE,bwd=6,col=c("red","blue","green"),csize=.5)
mon2$run1 # gives the content of first boundary
mon2$run1$dir1 # gives the content of first boundary, 1st direction
mon2$run1$dir1$path # gives the content of first boundary, 1st
direction, coordinates
##
Another simpler way maybe using Peter Solymos's coords.monmonier (see
?coords.monmonier):
##
> coords.monmonier(mon2)
$run1
$run1$dir1
x.hw y.hw first second
Point_1 5.585655 3.353934 16 50
Point_2 6.175788 3.745792 16 37
Point_3 6.050270 4.321076 37 50
Point_4 6.456283 4.801207 36 37
Point_5 7.097451 5.369001 21 36
Point_6 6.246300 5.912191 26 36
Point_7 5.534326 6.166065 26 34
$run1$dir2
x.hw y.hw first second
Point_1 5.585655 3.353934 16 50
Point_2 5.304805 3.512757 3 50
Point_3 4.769548 3.836670 3 15
[...]
##
Best,
Thibaut.
--
######################################
Dr Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
jombart at biomserv.univ-lyon1.fr
http://biomserv.univ-lyon1.fr/%7Ejombart/
http://adegenet.r-forge.r-project.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20081125/50ca02b6/attachment.htm
More information about the adegenet-forum
mailing list