| midpoints {phylin} | R Documentation | 
Midpoints between pairs of coordinates
Description
Computes the midpoints for a table of sample points with coordinates.
Usage
midpoints(samples, x=1, y=2, sp.name=row.names(samples), all=FALSE)
Arguments
samples | 
 Table with coordinates for each sample point.  | 
x | 
 Column index or name of longitudes (x) in samples table (default is first column).  | 
y | 
 Column index or name of latitudes (y) in samples table (default is second column).  | 
sp.name | 
 Name for each sample point (defaults to row names of samples).  | 
all | 
 If TRUE computes midpoints between all sample points. If FALSE (default) computes a Delaunay triangulation and the midpoints of the resulting connected samples.  | 
Details
This function computes the coordinates of the middle points between samples. The connecting network can be between all points or between neighbours with non-overlaping edges after a Delaunay triangulation.
Value
Returns a data frame with 4 columns referring the source and target samples (ss and ts, respectively) and the coordinates of the midpoints.
Note
Depends on package 'geometry' for Delaunay triangulation.
Author(s)
Pedro Tarroso <ptarroso@cibio.up.pt>
See Also
Examples
data(vipers)
mp <- midpoints(vipers[,1:2], all=TRUE) 
# With 'all=FALSE' (Delaunay triang.), package 'geometry' is mandatory.