假设我有点的坐标,每个ID。我如何sdhould提取德劳内三角距离列出对象中的R?如何提取德劳内三角距离列出对象中的R
# My data are similar to this structure
id <- c("A","B","C","D","E","F","G","H","I","J","K","L","M","N")
x_coor <- c(0.5,1,1,1.5,2,3,3,3.5,4,4.5,5,5,6,7)
y_coor <- c(5.5,3,7,6.5,5,3.5,3,1.5,1,2.5,4,5,3.5,5.5)
my.data <- data.frame(id = id, x_coor = x_coor, y_coor = y_coor)
# When I perform Delaunay triangulation, I can see the distances....
library(tripack)
my.triangles<-tri.mesh(my.data$x_coor, my.data$y_coor)
plot(my.triangles, do.points=FALSE, lwd=0.2)
points(my.data$x, my.data$y, col = "black", pch=20, cex = 1.5)
text(my.data$x, my.data$y, labels = my.data$id)
我怎样才能提取点的 “双” 列出对象也是这样吗?
# I need something like this...
my.list
[[A]]
[1] 2.55 1.58 1.41 1.58 (all distances connected to "A")
[[B]]
[1] 2.55 2.24 2.06 2.00 2.92 3.61 (all distances connected to "B")
etc.
伟大的工作@Shekeine!非常感谢计算效率和速度。 – 2014-10-10 21:26:52
当然,不是问题:-) – shekeine 2014-10-10 21:45:22