join count with a grid that has NA's
Thanks Roger Started with the easier of the two which was to turn NA into a factor level. However, I feel drawn to the "subsetting" option. However, here is my dilemma (or more like my ignorance at this point) 1. spdep has subset.listw and subset.nb to subset the spatial weights or the neighbors lists respectively (by the way does c(31, 34) in the example in the help file mean that columns 31 and 34 will be dropped?) 2 However, I have (using RSiteSearch) tried to look for a function subsetting a spatialgriddataframe but have had no luck. Any pointers More fundamentally, my intuition is that I need to start the subsetting process with mygrid and somehow retain a vector of the rows or columns dropped and pass this information on the the subset.listw or subset.nb so that the same cells are dropped in the neighbor list. Now that is as far as I can go (thinking...), any ideas on how to proceed? Ronnie
Roger Bivand wrote:
On Mon, 9 Jan 2006, Ronnie Babigumira wrote:
Hi listers I am trying to apply join counts stats however my grid has some NA's and so I get an error
> joincount.multi(mygrid.f, nb2listw(mynb, style="B"))
Error in joincount.multi(mygrid.f, nb2listw(mynb, style="B")) :
NA in factor
My feeling was that the NA's can be ignored but looking at
?joincount.multi I dont see any options for ignoring NA's. Any ideas on
a work around this
Two possibilities: subset the data and the neighbour list to remove the NA cells - use subset methods, or turn NA into a factor level - a different category - and include it in the analysis (so counting NA/NA and NA with real level joins too). Neither very good, nor very bad, depends on your needs. You have to make the decision, there isn't an obviously right one, especially not just omitting NA/other and NA/NA counts internally by ignoring them, because then the join count sums will not agree with the neighbour graph geometry sums. Roger
Ronnie
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo