试图计算两个数据集中纬度/经度点之间的距离矩阵......这是我的 R 脚本代码,然后是错误消息。关于我哪里出错的任何想法?
> library(geosphere)
## step 1: open 2000 data for birds and air temp
> birds<-read.table(file.choose(),header=T,sep="\t")
> birds
> temp<-read.table(file.choose(),header=T,sep="\t")
> temp
##step 2: calculate the distance matrix D, which is the distance between lat/long points in your two datasets
> D = distm (birds<- 3:2, temp<- 2:1)
> new_birds =cbind(birds, temp[apply(D , 1 , which.min),])
temp[apply(D, 1, which.min), ] 中的错误:维数不正确