adjacency: Adjacent cells

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Identify pairs of cells that are adjacent.

Usage

1

Arguments

x

TransitionLayer

Details

Extracts the indices of those cells that are connected (e.g. cells i,j that have a non-zero value in the transition matrix).

Cell numbers are unique indices of cells in the original grid. By convention, cell numbers start with 1 in the upper-left corner of the grid and increase from left to right and from top to bottom.

Value

A two column matrix with each row containing a pair of adjacent cells.

Author(s)

Jacob van Etten jacobvanetten@yahoo.com

See Also

adjacent

Examples

1
2
3
4
r <- raster(nrows=6, ncols=7, xmn=0, xmx=7, ymn=0, ymx=6, crs="+proj=utm +units=m")
r[] <- runif(6*7)
T <- transition(r, function(x) 1/mean(x), 8) 
adjacencyFromTransition(T)

Example output

Loading required package: raster
Loading required package: sp
Loading required package: igraph

Attaching package: 'igraph'

The following object is masked from 'package:raster':

    union

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

Loading required package: Matrix

Attaching package: 'gdistance'

The following object is masked from 'package:igraph':

    normalize

NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
       [,1] [,2]
  [1,]    2    1
  [2,]    8    1
  [3,]    9    1
  [4,]    1    2
  [5,]    3    2
  [6,]    8    2
  [7,]    9    2
  [8,]   10    2
  [9,]    2    3
 [10,]    4    3
 [11,]    9    3
 [12,]   10    3
 [13,]   11    3
 [14,]    3    4
 [15,]    5    4
 [16,]   10    4
 [17,]   11    4
 [18,]   12    4
 [19,]    4    5
 [20,]    6    5
 [21,]   11    5
 [22,]   12    5
 [23,]   13    5
 [24,]    5    6
 [25,]    7    6
 [26,]   12    6
 [27,]   13    6
 [28,]   14    6
 [29,]    6    7
 [30,]   13    7
 [31,]   14    7
 [32,]    1    8
 [33,]    2    8
 [34,]    9    8
 [35,]   15    8
 [36,]   16    8
 [37,]    1    9
 [38,]    2    9
 [39,]    3    9
 [40,]    8    9
 [41,]   10    9
 [42,]   15    9
 [43,]   16    9
 [44,]   17    9
 [45,]    2   10
 [46,]    3   10
 [47,]    4   10
 [48,]    9   10
 [49,]   11   10
 [50,]   16   10
 [51,]   17   10
 [52,]   18   10
 [53,]    3   11
 [54,]    4   11
 [55,]    5   11
 [56,]   10   11
 [57,]   12   11
 [58,]   17   11
 [59,]   18   11
 [60,]   19   11
 [61,]    4   12
 [62,]    5   12
 [63,]    6   12
 [64,]   11   12
 [65,]   13   12
 [66,]   18   12
 [67,]   19   12
 [68,]   20   12
 [69,]    5   13
 [70,]    6   13
 [71,]    7   13
 [72,]   12   13
 [73,]   14   13
 [74,]   19   13
 [75,]   20   13
 [76,]   21   13
 [77,]    6   14
 [78,]    7   14
 [79,]   13   14
 [80,]   20   14
 [81,]   21   14
 [82,]    8   15
 [83,]    9   15
 [84,]   16   15
 [85,]   22   15
 [86,]   23   15
 [87,]    8   16
 [88,]    9   16
 [89,]   10   16
 [90,]   15   16
 [91,]   17   16
 [92,]   22   16
 [93,]   23   16
 [94,]   24   16
 [95,]    9   17
 [96,]   10   17
 [97,]   11   17
 [98,]   16   17
 [99,]   18   17
[100,]   23   17
[101,]   24   17
[102,]   25   17
[103,]   10   18
[104,]   11   18
[105,]   12   18
[106,]   17   18
[107,]   19   18
[108,]   24   18
[109,]   25   18
[110,]   26   18
[111,]   11   19
[112,]   12   19
[113,]   13   19
[114,]   18   19
[115,]   20   19
[116,]   25   19
[117,]   26   19
[118,]   27   19
[119,]   12   20
[120,]   13   20
[121,]   14   20
[122,]   19   20
[123,]   21   20
[124,]   26   20
[125,]   27   20
[126,]   28   20
[127,]   13   21
[128,]   14   21
[129,]   20   21
[130,]   27   21
[131,]   28   21
[132,]   15   22
[133,]   16   22
[134,]   23   22
[135,]   29   22
[136,]   30   22
[137,]   15   23
[138,]   16   23
[139,]   17   23
[140,]   22   23
[141,]   24   23
[142,]   29   23
[143,]   30   23
[144,]   31   23
[145,]   16   24
[146,]   17   24
[147,]   18   24
[148,]   23   24
[149,]   25   24
[150,]   30   24
[151,]   31   24
[152,]   32   24
[153,]   17   25
[154,]   18   25
[155,]   19   25
[156,]   24   25
[157,]   26   25
[158,]   31   25
[159,]   32   25
[160,]   33   25
[161,]   18   26
[162,]   19   26
[163,]   20   26
[164,]   25   26
[165,]   27   26
[166,]   32   26
[167,]   33   26
[168,]   34   26
[169,]   19   27
[170,]   20   27
[171,]   21   27
[172,]   26   27
[173,]   28   27
[174,]   33   27
[175,]   34   27
[176,]   35   27
[177,]   20   28
[178,]   21   28
[179,]   27   28
[180,]   34   28
[181,]   35   28
[182,]   22   29
[183,]   23   29
[184,]   30   29
[185,]   36   29
[186,]   37   29
[187,]   22   30
[188,]   23   30
[189,]   24   30
[190,]   29   30
[191,]   31   30
[192,]   36   30
[193,]   37   30
[194,]   38   30
[195,]   23   31
[196,]   24   31
[197,]   25   31
[198,]   30   31
[199,]   32   31
[200,]   37   31
[201,]   38   31
[202,]   39   31
[203,]   24   32
[204,]   25   32
[205,]   26   32
[206,]   31   32
[207,]   33   32
[208,]   38   32
[209,]   39   32
[210,]   40   32
[211,]   25   33
[212,]   26   33
[213,]   27   33
[214,]   32   33
[215,]   34   33
[216,]   39   33
[217,]   40   33
[218,]   41   33
[219,]   26   34
[220,]   27   34
[221,]   28   34
[222,]   33   34
[223,]   35   34
[224,]   40   34
[225,]   41   34
[226,]   42   34
[227,]   27   35
[228,]   28   35
[229,]   34   35
[230,]   41   35
[231,]   42   35
[232,]   29   36
[233,]   30   36
[234,]   37   36
[235,]   29   37
[236,]   30   37
[237,]   31   37
[238,]   36   37
[239,]   38   37
[240,]   30   38
[241,]   31   38
[242,]   32   38
[243,]   37   38
[244,]   39   38
[245,]   31   39
[246,]   32   39
[247,]   33   39
[248,]   38   39
[249,]   40   39
[250,]   32   40
[251,]   33   40
[252,]   34   40
[253,]   39   40
[254,]   41   40
[255,]   33   41
[256,]   34   41
[257,]   35   41
[258,]   40   41
[259,]   42   41
[260,]   34   42
[261,]   35   42
[262,]   41   42

gdistance documentation built on May 2, 2019, 5:46 p.m.