Learn R Programming

GeNetIt (version 0.1-6)

flow: Convert distance to flow

Description

Converts distance to flow (1-d) with or without data standardization

Usage

flow(x, standardize = FALSE, rm.na = FALSE, diag.value = NA)

Value

A vector or matrix representing flow values

Arguments

x

A numeric vector or matrix object representing distances

standardize

(FALSE/TRUE) Row-standardize the data before calculating flow

rm.na

(TRUE/FALSE) Should NA's be removed, if FALSE (default) the will be retained in the results

diag.value

If x is a matrix, what diagonal matrix values should be used (default is NA)

Author

Jeffrey S. Evans <jeffrey_evans@tnc.org> and Melanie A. Murphy <melanie.murphy@uwyo.edu>

Examples

Run this code
#### On a distance vector
flow(runif(10,0,1))
flow(runif(10,0,500), standardize = TRUE)

# With NA's
d <- runif(10, 0,1)
  d[2] <- NA
flow(d)
flow(d, rm.na=TRUE)

#### On a distance matrix
dm <- as.matrix(dist(runif(5,0,1), diag = TRUE, upper = TRUE))
flow(dm)

Run the code above in your browser using DataLab