[R] outlining data points

David Winsemius dwinsemius at comcast.net
Sat Jun 4 16:28:08 CEST 2011


On Jun 3, 2011, at 7:20 PM, lana wrote:

> Hi,
>     I have tried numerous methods and packages, but thus far cannot  
> seem to
> find a solution. I am looking to essentially draw a filled colored  
> shape
> around subsets on my data points on a scatter plot where none of the  
> shapes
> overlap but instead bend around each other if necessary. I finally  
> came up
> with the following steps which approximate what I am looking for,  
> but I am
> completely lost as to how to implement several of the steps. The  
> steps are
> listed below, along with a pictorial representation of what I am  
> hoping they
> will achieve. Any suggestions would be greatly appreciated.

Are you trying to reinvent the wheel? A typical test for clustering  
algorithms that attempt to find non-convex clusters (ones that "bend  
around") is the rFace function. Searching with the engine used to  
support the RSiteSearch function finds 17 R functions in various  
packages that use it in their examples:

http://search.r-project.org/cgi-bin/namazu.cgi?query=rFace&max=100&result=normal&sort=score&idxname=functions

-- 
David.


>
> 1. Draw a circle of a give radius around each data point
> 	radius can be the same for each point, or can be determined by a  
> vector of
> values either the same length of the number of points or is repeated  
> until
> all points are assigned
> 2. Begin with the area of greatest overlap between two circles, draw  
> a line
> segment between the two intersection points and assign either side  
> of that
> line to its respective shape
> 3. Repeat with largest remaining area of overlap. If a previous  
> division has
> left an intersection point within the new area of overlap, such that  
> there
> are now two possible points to attach the line segment to, use the  
> one from
> which a division has already been drawn (so that three shapes now come
> together in a point)
> 4. Repeat with successively smaller areas of overlap until no remain
> 5. Fill each resulting shape with a color determined by an outside  
> vector
> associated with the points
> 6. (if possible) calculate the area of each resultant shape
>
> http://r.789695.n4.nabble.com/file/n3572306/diagram_circles_coloring_3.png
>
> http://r.789695.n4.nabble.com/file/n3572306/circle_interactions_3.png
>
> --
> View this message in context: http://r.789695.n4.nabble.com/outlining-data-points-tp3572306p3572306.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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list