eco.slide.con: Sliding a window along a connection network

Description Usage Arguments Author(s) Examples

View source: R/eco.slide.con.R

Description

This program applies a function defined by the user, over the individuals included in a connection network. For a given variable, the program computes recursively a function for the individuals of the network, using all the individuals connected to each. The function uses a connection network generated with the function eco.weight.

Usage

1
eco.slide.con(x, con, fun)

Arguments

x

Input variable or matrix.

con

Connection network.

fun

Function to apply in each focal point.

Author(s)

Leandro Roser learoser@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 

data(eco2)
myMatrix <- eco2[["P"]]
con <- eco.weight(XY = eco2[["XY"]], method = "knearest", k = 5)
result <- eco.slide.con(myMatrix, con, function(x) mean(x, na.rm = TRUE))

image(matrix(myMatrix[, 1], 30, 30)) # original image
image(matrix(result[, 1], 30, 30)) # smoothed image

data(eco3)
myMatrix2 <- eco3[["P"]]
con <- eco.weight(XY = eco3[["XY"]], method="knearest", k = 5)
eco.plotWeight(con)
# smoothing values in myMatrix2 using the connection network:
result <- eco.slide.con(myMatrix2, con, function(x) mean(x, na.rm = TRUE))


## End(Not run)

EcoGenetics documentation built on July 8, 2020, 5:46 p.m.