Learn R Programming

phylin (version 2.0.2)

geo.dist: Geographical distance matrix for samples and interpolation locations.

Description

Calculates a geographical euclidean distances matrix based on a list of coordinates for samples and for interpolation locations.

Usage

geo.dist(from, to)

Arguments

from

Data frame with coordinates for source locations. Should have two columns (longitude and latitude).

to

Data frame with coordinates for destination locations to where distances are calculated. Should have two columns (longitude and latitude).

Value

Return the matrix of euclidean distances between source locations ('from') to destination ('to') coordinates. The resulting matrix has source locations in rows and destination in columns and respective names are given based on the row names of the 'from' and 'to' data frames.

Examples

Run this code
# NOT RUN {
data(vipers)

# create a grid of the sampled area
grid <- expand.grid(x=seq(-10,10,0.5), y=seq(30, 50, 0.5))

rd <- geo.dist(vipers[,1:2], grid)
# }

Run the code above in your browser using DataLab