0

我正在尝试运行该功能

gw.dist(dp.locat, rp.locat, focus=0, p=2, theta=0, longlat=F)

在 R 包 GWmodel 中。

随文档提供的示例显示以下内容:

首先创建一些模拟数据

dp<-cbind(sample(100),sample(100))

dp

       [,1] [,2]
  [1,]   45   97
  [2,]   37   55
  [3,]   83   69
  [4,]   14   11
  [5,]   49   31
  [6,]   91   35
  [7,]   54   27
  [8,]   23   16
  [9,]   28   10
 [10,]   99   77
 [11,]    2  100
 [12,]   38   89
 [13,]   20   45
...
[100,]   74   66

然后应用函数

dist.v1<-gw.dist(dp.locat=dp, focus=5, p=2, theta=0, longlat=FALSE)

这给出了这个结果:

 [1] 66.121101 26.832816 50.990195 40.311289  0.000000 42.190046  6.403124 30.016662 29.698485
[10] 67.941151 83.486526 59.033889 32.202484 51.009803  1.414214 33.060551 58.694122 60.000000
[19] 49.396356 50.328918 31.048349 69.641941 30.870698 22.825424 69.123079 50.606324 41.593269
[28] 72.801099 32.388269 30.000000 56.142675 24.083189 40.706265 66.528190 44.654227 25.495098
[37] 52.478567 51.078371 38.832976 52.773099 50.219518 49.396356 58.728187 17.464249 34.000000
[46] 52.201533 60.033324 40.706265 43.566042 73.878278 42.047592 41.109610 51.419841 26.627054
[55] 49.030603 17.691806 72.069411 30.083218 18.027756 43.046487 59.682493 43.278170 24.351591
[64] 49.819675 42.801869 13.601471 58.051701 64.280635 53.460266  9.219544 41.785165 15.652476
[73] 41.868843 27.018512 28.844410  9.055385 77.620873 74.330344 55.226805  3.605551 48.083261
[82] 49.091751 29.966648 45.607017 18.027756 33.615473 29.427878 19.235384 41.036569 27.658633
[91] 48.826222 45.343136 52.886671 45.650849 29.410882 62.936476 21.840330 25.079872 22.360680
[100] 43.011626

我正在尝试对自己的数据做同样的事情

locations <- cbind(Eng$Latitude,Eng$Longitude)

locations

             [,1]      [,2]
    [1,] 51.49752 -0.149860
    [2,] 53.80765 -3.045101
    [3,] 51.55375 -0.259466
    [4,] 50.80333 -1.088333
    [5,] 50.90520 -1.393890
    [6,] 55.54942 -1.728630
    [7,] 51.54975 -0.117760
    [8,] 52.05692  1.160946
    [9,] 51.50116 -0.226078
   [10,] 51.46406 -0.117073   
   ...
  [351,] 52.18220 -0.804491

将函数设置为:

dist.v1<-gw.dist(locations.locat=locations, focus=5, p=2, theta=0, longlat=FALSE)

但是,我收到错误:

ERROR: unused argument (locations.locat = locations)

我怎么了?谢谢。

4

1 回答 1

2

你有一个错字:论点是dp.locat,不是locations.locat

于 2015-08-15T12:04:13.103 回答