[R] voronoi.mosaic chokes?

Christos Hatzis christos at nuverabio.com
Wed May 9 06:40:40 CEST 2007

Have you tried 'debug'?

With one of the datasets that crashes your system, run the first
voronoi.mosaic, then the torus function and then


and run through the second call of voronoi.mosaic.  You can step though the
code and at least will you find the point where it bombs.


Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Andrew Pierce
> Sent: Wednesday, May 09, 2007 12:21 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] voronoi.mosaic chokes?
> Hi all,
> I am running R 2.5.0 under Windows XP Media Center Edition.  
> Here's a problem that's been stumping me for a few days now, 
> and I can't find anything useful in the archives.  I am using 
> voronoi.mosaic (tripack
> package) to create proximity polygons for a study of 
> vegetation competition and dynamics.  The points lists are 
> read in from a file for each plot, then 8 duplicates are 
> translated around the edges of the plot (Toroidal edge 
> correction).  This is completed using the torus(...) function 
> that I wrote myself.
> VMuncorrected is the voronoi  mosaic that is not toroidally 
> edge corrected VMcorrected is the voronoi mosaic that is 
> toroidally edge corrected
>  >treemap = read.table('af1.txt', sep = "\t", header = 1)  
> >VMuncorrected = voronoi.mosaic(treemap$X, treemap$Y)
> ###Use the torus function to create 8 copies around the study 
> region  >toroid = torus(treemap$X, treemap$Y, 25, 25)
>  >VMcorrected = voronoi.mosaic(toroid[,1], toroid[,2], 
> duplicate = "remove")
> Here's the problem. When I read in the points for the data 
> file listed above ('af1.txt'), both calls to voronoi.mosaic() 
> work fine.  (The second one takes about 1.5 seconds because 
> there are 1147 points in the toroidally corrected set).
> However, when I read in the points from the next file 
> ('af2.txt'), the first call to voronoi.mosaic() works.  The 
> next call (to torus()) also works fine.  But the second call 
> to voronoi.mosaic() causes R to freeze completely requiring 
> Ctrl-Alt-Del.
> I have 10 sets of points and this problem happens for about 5 of them.
> Factors I have ruled out:
> -too many points in the call (one set had 1147 and worked 
> fine while the next set had 801 and froze R) -duplicate 
> points (taken care of by voronoi.mosaic(..., duplicate =
> "remove") and also independently verified by exporting the 
> data.  no duplicates in either the original or the toroidally 
> corrected set) -points too close together in space (minimum 
> distance between two points in 'af1.txt' is 0.1414 and works 
> fine.  minimum distance in the second set, 'af2.txt', is 
> 0.2236, and this set causes R to freeze) -not enough memory 
> (each data set is run in a new R session-i.e. R was quit 
> between each attempt) -'flukiness' (the problem happens the 
> same way every time for the problem data sets, and the code 
> runs fine every time for the non-problem data sets) -file 
> formats (each text file has the same number of columns, all 
> the labels for the columns are identical, and the columns are 
> always in the same order) -outdated versions (I am using R 
> 2.5.0 and updated the tripack package within the last week.  
> also, I update packages about once a month)
> This is a very frustrating problem because I get no errors 
> indicating any problem with the data, and I have checked the 
> data over and over for any type of error and found none.  If 
> anyone has ANY helpful suggestions, I would love to hear 
> about any and all of them.
> Andrew
> p.s. - for those of you who are really intrigued, I can email 
> you the .txt files and the code for the torus() function.
> ______________________________________________
> R-help at stat.math.ethz.ch 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