2015-08-15 70 views
0

我試圖運行功能錯誤:gw.dist功能未使用的參數中的R GWmodel包

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) 

我是什麼出錯了?謝謝。

+0

我想你想'dp.locat',而不是'locations.locat'。 –

+0

太棒了。非常感謝你。如果你想回答我會解決問題 –

回答

2

您有一個錯字:參數是dp.locat,而不是locations.locat

相關問題