Thanks Andy, that did it!

In summary, depending on the magnitude of the spatial units, an error may
occur:

> b <- ah2sp(x.ah)
Error in if (is.numeric(i) && i < 0) { :
  missing value where TRUE/FALSE needed


 but that decreasing the default "rnd" argument will often fix this. For my
data, setting rnd = 2 worked.  It has to do with how the start and end
points of a polygon are matched, e.g., the line:

if (x[1] == round(prevx[length(prevx)],rnd) && y[1] ==
>> round(prevy[length(prevy)],rnd)
>
>
On Sun, Mar 4, 2012 at 12:52 PM, Andrew Bevan <a.bevan@ucl.ac.uk> wrote:

> Kevin
>
> Is this on your data or the toy data?
> If the former, try fiddling with the rnd argument as I had problems with
> this and could not think of an alternative at the time? So for example, try
>
> b <- ah2sp(x.ah, rnd=2)
>
> If not come back to me and I'll try to work through it a bit further.
>
> Andy
>
> On 4 Mar 2012, at 20:41, Kevin Goulding wrote:
>
> Hi Andy, Thanks for the code!  I am getting an error, though, in the last
> line:
>
> > b <- ah2sp(x.ah)
> Error in if (is.numeric(i) && i < 0) { :
>   missing value where TRUE/FALSE needed
>
> ...After a bit of debugging, the error pops up in the line:
>    res <- res[which(res@data$Area > 0),]
>
> Because "which(res@data$Area > 0)" returns "integer(0)"
>
> After looking at the res@data$Area object, it appears there are a bunch
> of objects with non-zero areas, but it doesn't seem like they are being
> picked up.  My unfamiliarity with S3 and S4 objects prevents effective
> debugging.
>
> Any thoughts?
>
> Thanks, Kevin
>
>
>

	[[alternative HTML version deleted]]

