I've recently started using the fantastic alphahull R package, which works beautifully most of the time but occasionally I am getting the following error when running the areaahull() function:
Error in row:rownew : NA/NaN argument
For most of my data the function works as expected, but with some data and for certain values of alpha, the above fatal error occurs. It does not seem to depend on the complexity of the data, sometimes the error occurs with a few dozen data points, while it will run fine with a dataset of a few thousand points.
The code is very straightforward, simply by changing the value of alpha for a given dataset I can generate the error.
library(alphahull) lonlat <- read.csv("areaahull_error.csv") alpha <- 0.2 alphahull <- ahull(lonlat, alpha = alpha) areaahull(alphahull)
I'd be interested to know if anyone else has seen this error and if there's anything to be done about it, other than trying to catch it, or tweak alpha to avoid it when it occurs.