Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在R中使用geosphere软件包时标注数量不正确_R_Geospatial_Geosphere - Fatal编程技术网

在R中使用geosphere软件包时标注数量不正确

在R中使用geosphere软件包时标注数量不正确,r,geospatial,geosphere,R,Geospatial,Geosphere,正在尝试计算两个数据集中lat/long点之间的距离矩阵。。。。 这是我的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(),heade

正在尝试计算两个数据集中lat/long点之间的距离矩阵。。。。 这是我的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),])
>库(geosphere)
##步骤1:打开鸟类和气温的2000年数据
>鸟
>温度
##步骤2:计算距离矩阵D,它是两个数据集中lat/long点之间的距离

>D=distm(birds你能包括创建temp和D的代码吗,或者至少是dim(temp)class(temp)dim(D)class(D)的输出吗?看来temp不是一个二维对象。谢谢,@mdsumner和42-我已经编辑了这个问题以包含代码。这是你的意思吗?你是想使用
birds吗