To delete a link, click on its two nodes. Follow on-screen instructions. Wait until
you have finished editing before entering the next command line.
# 2. Alternatively, links can also be removed by command lines,
# after having converted the nb object into an editable matrix:
mite.del.mat <- nb2mat(mite.del, style = "B")
# Remove connection between objects 23 and 35:
mite.del.mat[23,35] <- 0
mite.del.mat[35,23] <- 0
# Back-conversion into nb object:
mite.del3 <- neig2nb(neig(mat01 = mite.del.mat))
plot(mite.del3, mite.xy)
# Example: list of neighbours of site 23 for the Delaunay
#
triangulation:
mite.del[[23]]
# Before editing
mite.del2[[23]]
# After interactive editing - depends on what
# you have edited above.
mite.del3[[23]]
# After command line editing
The following code shows how to construct connectivity matrices based on a
distance: pairs of sites within a given radius are connected, the others are not.
# Connectivity matrix based on a distance (radius around points)
# Using the same truncation distance dmin as in the dbMEM
# example (1.011187).
dmin = 1.011187
mite.thresh4 <- dnearneigh(as.matrix(mite.xy), 0, dmin * 4)
# Display some values
nb2mat(mite.thresh4)[1:10, 1:10]
# Using a shorter distance (1 * dmin, 2 * dmin)
mite.thresh1 <- dnearneigh(as.matrix(mite.xy), 0, dmin * 1)
mite.thresh2 <- dnearneigh(as.matrix(mite.xy), 0, dmin * 2)
# Using a longer distance
mite.thresh8 <- dnearneigh(as.matrix(mite.xy), 0, dmin * 8)
# Plot of some connectivity matrices
par(mfrow = c(1,2))
plot(mite.thresh1, mite.xy, col = "red", pch = 20, cex = 0.8)
title(main = "1 * dmin")
plot(mite.thresh4, mite.xy, col = "red", pch = 20, cex = 0.8)
title(main = "4 * dmin")
344
7 Spatial Analysis of Ecological Data
you have finished editing before entering the next command line.
# 2. Alternatively, links can also be removed by command lines,
# after having converted the nb object into an editable matrix:
mite.del.mat <- nb2mat(mite.del, style = "B")
# Remove connection between objects 23 and 35:
mite.del.mat[23,35] <- 0
mite.del.mat[35,23] <- 0
# Back-conversion into nb object:
mite.del3 <- neig2nb(neig(mat01 = mite.del.mat))
plot(mite.del3, mite.xy)
# Example: list of neighbours of site 23 for the Delaunay
#
triangulation:
mite.del[[23]]
# Before editing
mite.del2[[23]]
# After interactive editing - depends on what
# you have edited above.
mite.del3[[23]]
# After command line editing
The following code shows how to construct connectivity matrices based on a
distance: pairs of sites within a given radius are connected, the others are not.
# Connectivity matrix based on a distance (radius around points)
# Using the same truncation distance dmin as in the dbMEM
# example (1.011187).
dmin = 1.011187
mite.thresh4 <- dnearneigh(as.matrix(mite.xy), 0, dmin * 4)
# Display some values
nb2mat(mite.thresh4)[1:10, 1:10]
# Using a shorter distance (1 * dmin, 2 * dmin)
mite.thresh1 <- dnearneigh(as.matrix(mite.xy), 0, dmin * 1)
mite.thresh2 <- dnearneigh(as.matrix(mite.xy), 0, dmin * 2)
# Using a longer distance
mite.thresh8 <- dnearneigh(as.matrix(mite.xy), 0, dmin * 8)
# Plot of some connectivity matrices
par(mfrow = c(1,2))
plot(mite.thresh1, mite.xy, col = "red", pch = 20, cex = 0.8)
title(main = "1 * dmin")
plot(mite.thresh4, mite.xy, col = "red", pch = 20, cex = 0.8)
title(main = "4 * dmin")
344
7 Spatial Analysis of Ecological Data
