midpoints: Midpoints between pairs of coordinates

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/midpoints.R

Description

Computes the midpoints for a table of sample points with coordinates.

Usage

1
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

dist d.gen extract.val

Examples

1
2
3
data(vipers)
mp <- midpoints(vipers[,1:2], all=TRUE) 
# With 'all=FALSE' (Delaunay triang.), package 'geometry' is mandatory.

phylin documentation built on Dec. 12, 2019, 5:07 p.m.