Hi folks!

I'm using the 'skater' function of the spdep package in order to regionalize 
the forest disturbance regime over British Columbia. I'm using this function 
since at least 7 months and didn't have any problem until today. Actually, when 
I run the skater function, R crashes any time I add a restriction for cluster 
size (based on AREA_HA). If I don't use any size restriction, there is no 
problem.  Is it an overflow?  I suspect this is because there is a lot of 
heterogeneity between contiguous units (connected by the mstree). I did  use 
the same polygons with other variables and there was no crash.

Here's my code : 

library(spdep)

library(rgdal)
ecodist_BC <- readOGR(".", "ecodist_BC_pettit")#  

ecodist_BC_data <- data.frame(ecodist_BC@data$PAAB, 
ecodist_BC@data$ANFIRE100K,ecodist_BC@data$MEANDOY,ecodist_BC@data$MNSIZE)
ecodist_BC_scale <- data.frame(scale(ecodist_BC_data[,1:4]))
ecodist_BC.nb<-poly2nb(ecodist_BC) # 
coord_ecodist_BC <-coordinates(ecodist_BC)
n.comp.nb(ecodist_BC.nb)# 2 subgraphs

ecodist_BC.nb2 <- edit.nb(ecodist_BC.nb,coord_ecodist_BC,ecodist_BC) 
#contiguity added between ecodistricts #943 and #945

lcosts_ecodist_BC.nb2 <- nbcosts(ecodist_BC.nb2, ecodist_BC_scale)
ecodist_BC.nb2.w <- nb2listw(ecodist_BC.nb2, lcosts_ecodist_BC.nb2, style="B")
mst.ecodist_BC.nb2 <- mstree(ecodist_BC.nb2.w)

res.ecodist_BC1<-skater(mst.ecodist_BC.nb2[,1:2], ecodist_BC_scale, 49, 
2*median(ecodist_BC@data$AREA_HA), ecodist_BC@data$AREA_HA) # 
2*median(ecodist_BC@data$AREA_HA) ~ 1 322 000 ha 

I'm using R 2.13.0 on WinXP Pro with the latest package updates

Thanks a lot!

Yan


Yan Boulanger 
Ressources Naturelles Canada
Service Canadien des Forêts - Centre de Foresterie des Laurentides
1055, rue du PEPS
CP 10380, Succ. Ste-Foy
Québec, QC, G1V 4C7
Tel. : +001 418 649-6859
Fax :  +001 418 648-5849 
email : [email protected]
 



                                          
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to