[R] "inahull? from package alphahull not working when used with lapply

Camilo Mora cmora at Dal.Ca
Mon Oct 27 19:42:28 CET 2014


Hi Bart,

Even after putting the variables in the apply function, the results come not right:

library (alphahull)
DT=data.frame(x=c(0.25,0.25,0.75,0.75),y=c(0.25,0.75,0.75,0.25))
Hull <- ahull(DT, alpha = 0.5)

TEST<- data.frame(x=c(0.25,0.5),y=c(0.5,0.5))
plot(Hull)
points(TEST)

InHul2D <- function(Val1, Val2, Hull) inahull(Hull, p = c(Val1, Val2))

IN <- apply(TEST, 1, function(x,y) InHul2D("x","y",Hull))


	[[alternative HTML version deleted]]



More information about the R-help mailing list