How to compute distance.matrix for the spatialRF::rf_spatial function
nikosGeography opened this issue · 0 comments
nikosGeography commented
I have a data.frame
containg 5 columns. The first column is the dependent variable and the rest are the independent variables. When running the (default) spatialRF::rf_spatial
function I am getting this error: Error in spatialRF::rf_spatial(model = ntl ~ ., data = block.data, distance.matrix = NULL,: The argument 'distance.matrix' is missing.
I tried setting the distance.matrix = NULL
but still the same error. Can anyone help me understand how to compute the distance.matrix
using my dataset?
A very small sample of my dataset:
block.data = structure(list(ntl = c(11.4058170318604, 13.7000455856323, 16.0420398712158,
17.4475727081299, 26.263370513916, 30.658130645752, 19.8927211761475,
20.917688369751, 23.7149887084961, 25.2641334533691), pop = c(111.031448364258,
145.096557617188, 166.351989746094, 193.804962158203, 331.787200927734,
382.979248046875, 237.971466064453, 276.575958251953, 334.015289306641,
345.376617431641), tirs = c(35.392936706543, 34.4172630310059,
33.7765464782715, 35.3224639892578, 40.4262886047363, 39.6619148254395,
38.6306076049805, 36.752326965332, 37.2010040283203, 36.1100578308105
), agbh = c(1.15364360809326, 0.177780777215958, 0.580717206001282,
0.647109687328339, 3.84336423873901, 5.6310133934021, 2.10894227027893,
3.9533429145813, 2.7016019821167, 4.36041164398193), lc = c(40L,
40L, 40L, 126L, 50L, 50L, 50L, 50L, 40L, 50L)), class = "data.frame", row.names = c(NA,
-10L))