##读取含有地名、经纬度的excel文件
city_wmat <- read.table("clipboard",header=TRUE)
genW <- function (coords, labels)
{
W <- as.matrix(dist(coords))
colnames(W) <- labels
rownames(W) <- labels
W[which(W == Inf)] <- 0
return(W)
}
##注意这时的距离单位是:百公里
##距离倒数
genW <- function (coords, labels)
{
W <- 1/ as.matrix(dist(coords))
colnames(W) <- labels
rownames(W) <- labels
W[which(W == Inf)] <- 0
return(W)
}
wmat <- genW(cbind(city_wmat$weidu,city_wmat$jingdu),city_wmat$cityname)




雷达卡




,顺便想请问楼主,有关于经济距离权重矩阵的资料吗?
京公网安备 11010802022788号







