And*_*rie 18
您正在寻找chull()
在包grdevices中计算2D对象的凸包的函数.
以下是在线帮助中的示例:
require(stats)
X <- matrix(rnorm(2000), ncol = 2)
chull(X)
## Not run:
# Example usage from graphics package
plot(X, cex = 0.5)
hpts <- chull(X)
hpts <- c(hpts, hpts[1])
lines(X[hpts, ])
Run Code Online (Sandbox Code Playgroud)