2.1 Spatial data and R packages for mapping

Type of Spatial data:

  • areal
  • geostatistical
  • point patterns
library(tidyverse)
library(sf)
library(rgdal)
library(viridis)
library(geoR)
library(cholera)
library(mapview)
library(leaflet)
library(leafsync)
library(RColorBrewer)
library(tmap)
library(knitr)

Packages used:

  • ggplot2
  • leaflet
  • mapview
  • tmap

2.1.1 Types of spatial data

Define the space:

\[\left\{Z(s):s\in D \subset \mathbf{R^d} \right\}\]

\[Z=\text{observed values}\] \[s=\text{location}\] \[D=\text{domain (aereal, geostatistical, point patterns)}\]

\[d=\text{dimension}\]

2.1.1.1 Areal data

The domain \(D\) is fixed (of regular or irregular shape) and made of finite number of areal units with well-defined boundaries:

  • zip code
  • census tract
  • pixels
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"),
  quiet = TRUE
)


ggplot(data = nc, aes(fill = SID74)) + 
  geom_sf() +
  viridis::scale_fill_viridis() + 
  labs(title="Number of sudden infant deaths",
       subtitle="counties of North Carolina, USA, in 1974") +
  theme_bw()

2.1.1.2 Geostatistical data

The domain \(D\) is a continuous fixed:

  • air pollution
  • rainfall values

Data represent the average rainfall measurements for the period May-June (dry season) over different years collected at 143 recording stations throughout Paraná state, Brazil.

geoR::parana%>%head
## $coords
##            east     north
##   [1,] 402.9529 164.52841
##   [2,] 501.7049 428.77100
##   [3,] 556.3262 445.27065
##   [4,] 573.4043 447.04177
##   [5,] 702.4228 272.29590
##   [6,] 668.5442 261.67070
##   [7,] 435.8477 286.54044
##   [8,] 434.0125 317.90506
##   [9,] 432.4622 288.37001
##  [10,] 162.1458 286.29984
##  [11,] 169.4766 334.53158
##  [12,] 717.8468 181.56741
##  [13,] 713.3433 214.88336
##  [14,] 726.6630 207.27952
##  [15,] 618.4688 127.43265
##  [16,] 661.8808 128.81455
##  [17,] 506.7167 212.86691
##  [18,] 561.7874 138.89773
##  [19,] 585.6395 212.59809
##  [20,] 531.7106 131.62153
##  [21,] 308.9718 181.97682
##  [22,] 306.1047 148.69468
##  [23,] 150.1220 162.12624
##  [24,] 155.3399 154.86652
##  [25,] 620.0018 112.64927
##  [26,] 475.0577  83.64484
##  [27,] 366.8719  92.21224
##  [28,] 479.4953 461.96806
##  [29,] 615.7235 400.63795
##  [30,] 599.0729 456.12037
##  [31,] 566.5676 445.22857
##  [32,] 484.6613 423.22788
##  [33,] 445.5438 400.99330
##  [34,] 498.2953 426.92592
##  [35,] 477.9447 356.79285
##  [36,] 353.1834 446.50166
##  [37,] 338.5246 381.74695
##  [38,] 267.2320 373.39454
##  [39,] 676.8785 254.18138
##  [40,] 538.8900 308.77851
##  [41,] 340.9647 271.01967
##  [42,] 203.9369 309.41998
##  [43,] 254.2625 240.19632
##  [44,] 719.4624 177.84707
##  [45,] 768.5087 199.12352
##  [46,] 721.6547 209.20941
##  [47,] 687.7536 187.56295
##  [48,] 599.0604 210.66083
##  [49,] 541.8933 185.11924
##  [50,] 449.6865 196.16437
##  [51,] 357.5152 188.11980
##  [52,] 222.3395 154.59123
##  [53,] 297.3230 176.26524
##  [54,] 184.1727 211.03701
##  [55,] 401.9894  70.37282
##  [56,] 365.3621  77.42565
##  [57,] 331.6807 110.26775
##  [58,] 294.9501 113.43465
##  [59,] 674.3159 185.89772
##  [60,] 518.6908 378.94032
##  [61,] 562.7977 362.20880
##  [62,] 399.9123 354.61628
##  [63,] 309.6951 375.85998
##  [64,] 308.2159 359.22457
##  [65,] 397.5989 443.18080
##  [66,] 206.2979 359.35560
##  [67,] 289.3800 370.04023
##  [68,] 246.8030 374.89923
##  [69,] 279.5530 345.88871
##  [70,] 231.8296 450.35979
##  [71,] 245.5946 445.05926
##  [72,] 410.8090 242.10715
##  [73,] 400.0153 339.85273
##  [74,] 405.1119 338.04194
##  [75,] 422.4753 262.48003
##  [76,] 457.7338 306.92340
##  [77,] 388.4718 299.16275
##  [78,] 299.0782 285.24334
##  [79,] 320.4695 329.84407
##  [80,] 317.7274 279.96009
##  [81,] 328.1532 256.09127
##  [82,] 341.9647 271.01967
##  [83,] 346.0594 313.53010
##  [84,] 371.7581 278.71589
##  [85,] 377.0997 247.38436
##  [86,] 395.4668 267.83959
##  [87,] 244.7930 297.28745
##  [88,] 232.0861 343.23287
##  [89,] 212.3630 311.44174
##  [90,] 250.9284 238.28897
##  [91,] 249.1147 339.84732
##  [92,] 262.9887 321.61570
##  [93,] 264.8356 312.41223
##  [94,] 277.1810 281.21777
##  [95,] 267.4829 255.20257
##  [96,] 287.4249 273.99100
##  [97,] 291.2186 246.34864
##  [98,] 296.5940 340.60144
##  [99,] 295.1108 325.80878
## [100,] 211.6614 263.38789
## [101,] 189.3152 281.38550
## [102,] 165.9700 267.90686
## [103,] 164.2818 267.86614
## [104,] 184.9871 323.79426
## [105,] 711.8998 124.40728
## [106,] 749.5943 175.47115
## [107,] 702.7330 179.95796
## [108,] 650.7635 178.79807
## [109,] 640.7307 180.75360
## [110,] 600.6570 199.57391
## [111,] 421.2830 177.57037
## [112,] 451.4439 174.02255
## [113,] 419.3326 223.70296
## [114,] 377.7171 179.08881
## [115,] 357.4957 189.96577
## [116,] 372.2726 223.34289
## [117,] 287.3583 170.56964
## [118,] 285.6835 170.54282
## [119,] 224.3215 139.84991
## [120,] 218.9926 154.52067
## [121,] 262.6645 146.13850
## [122,] 217.2403 158.17924
## [123,] 212.6301 217.21353
## [124,] 249.3585 142.19763
## [125,] 245.9086 147.67415
## [126,] 251.2398 131.14844
## [127,] 197.7439 205.80201
## [128,] 172.8530 192.28300
## [129,] 187.8333 198.18379
## [130,] 568.3420 114.86877
## [131,] 541.6892 120.51877
## [132,] 493.3411  98.43402
## [133,] 471.6876 103.94229
## [134,] 445.0324 105.70264
## [135,] 479.9921 118.72419
## [136,] 333.2294 119.52053
## [137,] 400.3281  70.36000
## [138,] 343.6607  84.56600
## [139,] 320.2432  93.49421
## [140,] 331.8482  97.34366
## [141,] 235.3269  92.03407
## [142,] 226.5333 114.02601
## [143,] 692.5446 170.87504
## 
## $data
##   [1] 306.09 200.88 167.07 162.77 163.57 178.61 301.54 282.07 319.12 244.67
##  [11] 233.31 224.46 206.12 248.99 237.87 222.87 263.10 236.91 247.01 240.58
##  [21] 304.28 351.73 277.92 323.08 253.32 315.33 379.94 197.09 199.91 167.00
##  [31] 182.88 197.10 257.50 205.16 224.07 212.50 242.08 247.79 187.27 222.54
##  [41] 313.60 269.92 321.69 208.89 238.62 248.76 193.48 240.48 265.56 302.13
##  [51] 335.41 330.87 329.49 262.81 365.88 359.08 344.59 366.10 201.84 218.27
##  [61] 200.38 229.40 235.07 236.25 228.82 258.12 232.17 248.17 240.66 184.59
##  [71] 165.46 320.31 232.80 266.27 301.10 244.78 248.57 299.00 269.49 300.89
##  [81] 311.81 317.34 286.93 306.64 349.09 289.11 280.49 237.11 269.68 307.47
##  [91] 253.57 226.71 299.69 266.62 331.46 270.67 321.15 258.20 288.85 255.76
## [101] 264.77 271.76 313.63 252.94 246.75 215.95 299.71 203.40 209.47 185.63
## [111] 304.30 320.05 273.01 295.62 334.95 350.18 291.35 319.57 367.32 332.04
## [121] 332.18 323.82 334.22 345.33 345.24 383.13 348.67 282.54 291.07 245.42
## [131] 291.63 288.50 314.65 331.85 305.43 285.05 359.51 356.82 372.56 413.70
## [141] 412.44 400.96 199.37
## 
## $borders
##            east    north
##   [1,] 670.2049 111.7610
##   [2,] 663.7187 107.0510
##   [3,] 656.0667 105.2420
##   [4,] 649.9714 100.7915
##   [5,] 642.6346  97.9930
##   [6,] 635.2717 101.1545
##   [7,] 628.7421 105.5405
##   [8,] 622.7559 110.7495
##   [9,] 617.2708 116.3970
##  [10,] 610.4570 120.5795
##  [11,] 604.4217 119.6670
##  [12,] 600.2620 121.8980
##  [13,] 592.6210 119.9675
##  [14,] 585.4446 120.1770
##  [15,] 581.9288 115.7820
##  [16,] 574.8716 119.5320
##  [17,] 567.9908 115.8975
##  [18,] 565.6725 110.4990
##  [19,] 560.5745 117.3330
##  [20,] 553.8697 120.9290
##  [21,] 546.2617 121.4415
##  [22,] 542.4351 119.9445
##  [23,] 537.8374 117.3900
##  [24,] 534.3766 110.5270
##  [25,] 529.4094 104.3750
##  [26,] 528.1835  97.7945
##  [27,] 520.2682  98.8960
##  [28,] 513.7898  97.3895
##  [29,] 509.8332  94.0785
##  [30,] 505.1053  94.7300
##  [31,] 499.9772  98.2715
##  [32,] 491.9889  98.2600
##  [33,] 486.0944  93.4820
##  [34,] 478.8693  90.0065
##  [35,] 474.0457  83.7680
##  [36,] 470.9253  76.4215
##  [37,] 473.2195  69.7315
##  [38,] 476.8764  62.9205
##  [39,] 476.2482  55.2550
##  [40,] 468.8880  52.0755
##  [41,] 462.0776  49.4895
##  [42,] 457.8827  46.7695
##  [43,] 453.5177  53.7270
##  [44,] 448.9393  59.9580
##  [45,] 440.9253  58.8065
##  [46,] 433.2888  60.2470
##  [47,] 425.3856  60.1965
##  [48,] 417.6133  58.7055
##  [49,] 409.6899  58.7820
##  [50,] 402.0130  61.1070
##  [51,] 395.0903  64.9245
##  [52,] 388.9052  70.0245
##  [53,] 381.6208  72.8800
##  [54,] 373.6741  73.6025
##  [55,] 365.8110  74.9970
##  [56,] 358.0288  75.2305
##  [57,] 350.7182  77.7445
##  [58,] 343.3474  78.1710
##  [59,] 336.1592  80.7555
##  [60,] 329.2372  84.6880
##  [61,] 321.3298  84.1965
##  [62,] 313.6632  83.5640
##  [63,] 305.8023  83.2995
##  [64,] 298.2813  82.2695
##  [65,] 290.8616  80.2920
##  [66,] 284.2273  84.5905
##  [67,] 277.0778  87.9925
##  [68,] 271.5042  93.4435
##  [69,] 263.5438  94.2490
##  [70,] 256.5206  90.7505
##  [71,] 248.8575  88.9600
##  [72,] 241.6561  92.3015
##  [73,] 235.5201  96.4505
##  [74,] 231.7008 103.2460
##  [75,] 226.5476 109.2565
##  [76,] 225.8555 116.9060
##  [77,] 219.6574 122.0885
##  [78,] 216.4036 128.3540
##  [79,] 215.3407 136.1980
##  [80,] 216.7885 143.9200
##  [81,] 213.3187 151.0010
##  [82,] 212.5527 158.5445
##  [83,] 206.6640 163.6670
##  [84,] 201.8074 166.2495
##  [85,] 199.6235 167.2500
##  [86,] 192.1515 169.1685
##  [87,] 187.4222 165.4570
##  [88,] 188.9831 173.2480
##  [89,] 184.3990 174.2980
##  [90,] 178.4372 169.8080
##  [91,] 174.9494 168.8510
##  [92,] 170.3735 169.6690
##  [93,] 163.8374 165.8305
##  [94,] 157.8393 161.0635
##  [95,] 155.1347 154.8830
##  [96,] 150.0517 161.6140
##  [97,] 144.0864 164.5540
##  [98,] 138.8154 167.9450
##  [99,] 138.2976 176.1290
## [100,] 137.9873 183.5995
## [101,] 144.6532 179.9475
## [102,] 149.7815 181.6390
## [103,] 148.3825 189.3430
## [104,] 153.3881 190.8625
## [105,] 159.6861 188.6405
## [106,] 155.6298 192.2815
## [107,] 153.2130 196.7395
## [108,] 154.6873 201.9290
## [109,] 157.7371 202.4355
## [110,] 163.6586 198.6235
## [111,] 160.6753 201.4740
## [112,] 164.2113 207.0945
## [113,] 172.1300 206.1200
## [114,] 165.7289 207.3115
## [115,] 158.9356 205.5975
## [116,] 157.7503 210.4080
## [117,] 159.2718 213.2685
## [118,] 158.3999 216.1175
## [119,] 155.7833 220.7955
## [120,] 157.4876 222.7790
## [121,] 158.2476 224.8275
## [122,] 162.5890 225.7880
## [123,] 165.3917 228.3695
## [124,] 157.0779 228.7150
## [125,] 157.7547 233.2180
## [126,] 160.4128 242.7005
## [127,] 162.6142 248.6820
## [128,] 166.6488 249.4570
## [129,] 163.0228 253.9695
## [130,] 163.5307 258.6515
## [131,] 166.6522 265.2810
## [132,] 171.4813 265.8665
## [133,] 171.2810 266.8735
## [134,] 165.9287 272.0530
## [135,] 165.5064 279.3410
## [136,] 165.3565 286.6090
## [137,] 167.3168 293.7815
## [138,] 170.0333 301.3105
## [139,] 167.9776 309.0375
## [140,] 163.4914 315.4790
## [141,] 161.4737 323.2540
## [142,] 163.9975 330.3850
## [143,] 170.9306 334.1935
## [144,] 178.8615 335.4215
## [145,] 185.0876 340.1290
## [146,] 190.7308 345.8245
## [147,] 190.7629 353.3080
## [148,] 193.0867 360.8510
## [149,] 195.4518 368.4520
## [150,] 198.3416 375.9125
## [151,] 200.6131 383.4650
## [152,] 203.8286 390.7320
## [153,] 204.4282 398.7125
## [154,] 208.6809 405.3755
## [155,] 214.3330 411.0650
## [156,] 221.1810 415.0450
## [157,] 224.1224 422.3715
## [158,] 226.7607 429.8395
## [159,] 229.6904 437.2770
## [160,] 231.7297 444.9855
## [161,] 231.2201 453.0285
## [162,] 235.0386 459.9115
## [163,] 240.4021 465.8625
## [164,] 247.1194 470.1510
## [165,] 254.0619 474.1165
## [166,] 261.1909 477.7425
## [167,] 268.5502 480.8905
## [168,] 275.3702 485.0170
## [169,] 282.1118 489.3505
## [170,] 287.6720 495.0075
## [171,] 293.9856 499.9340
## [172,] 301.2117 503.1085
## [173,] 307.9379 499.2055
## [174,] 315.5170 496.7625
## [175,] 323.4097 495.3895
## [176,] 331.1514 496.8650
## [177,] 336.6722 500.3180
## [178,] 343.9110 497.0550
## [179,] 351.4178 497.7050
## [180,] 356.6217 494.4745
## [181,] 362.4410 496.3685
## [182,] 367.8282 491.1985
## [183,] 368.7925 491.6935
## [184,] 375.5148 489.4900
## [185,] 381.6668 493.9795
## [186,] 383.5345 501.5230
## [187,] 387.0024 507.9295
## [188,] 394.2589 504.9965
## [189,] 396.5233 497.1520
## [190,] 396.6447 503.3365
## [191,] 402.6135 502.9070
## [192,] 408.9709 498.0905
## [193,] 416.5279 497.7135
## [194,] 423.5764 496.9400
## [195,] 430.0549 493.1595
## [196,] 437.5379 492.2870
## [197,] 444.8926 489.9165
## [198,] 452.4828 492.5375
## [199,] 459.5602 493.5480
## [200,] 464.2114 490.9670
## [201,] 465.2680 483.0055
## [202,] 467.3369 482.2010
## [203,] 465.4588 490.2815
## [204,] 472.9838 491.8335
## [205,] 476.7251 484.8545
## [206,] 480.1985 482.7810
## [207,] 478.7206 474.8165
## [208,] 479.1671 473.0705
## [209,] 480.8995 480.3425
## [210,] 482.7832 472.1715
## [211,] 483.7279 468.8685
## [212,] 483.1949 476.6510
## [213,] 485.3765 481.3200
## [214,] 488.5307 474.7985
## [215,] 491.7474 475.4645
## [216,] 494.1562 479.5030
## [217,] 499.8788 474.7660
## [218,] 496.5055 470.4505
## [219,] 499.4508 467.3145
## [220,] 502.8627 465.8640
## [221,] 495.0628 463.6540
## [222,] 491.5965 461.1125
## [223,] 498.7098 459.3925
## [224,] 504.8521 454.5375
## [225,] 500.1448 452.6870
## [226,] 500.9931 443.8865
## [227,] 505.1344 444.3065
## [228,] 503.2360 451.4485
## [229,] 506.2289 457.7515
## [230,] 508.1602 463.0960
## [231,] 509.2235 470.4140
## [232,] 503.4734 475.6315
## [233,] 509.1783 476.1755
## [234,] 516.0340 473.3570
## [235,] 520.1472 467.0750
## [236,] 521.2369 459.4815
## [237,] 527.7531 459.3755
## [238,] 531.9956 464.7820
## [239,] 538.7836 464.8750
## [240,] 545.7071 465.6940
## [241,] 553.1392 462.5555
## [242,] 560.0246 464.8000
## [243,] 566.7468 463.1885
## [244,] 574.1973 462.7250
## [245,] 582.0237 461.2715
## [246,] 589.8874 462.5210
## [247,] 597.2293 465.8655
## [248,] 603.8112 464.5585
## [249,] 605.8710 460.5085
## [250,] 612.2869 456.0860
## [251,] 613.8571 449.5950
## [252,] 621.2878 446.6040
## [253,] 628.6391 444.8285
## [254,] 631.8174 437.7370
## [255,] 637.4924 432.0250
## [256,] 634.2047 425.4960
## [257,] 629.2266 422.5550
## [258,] 630.9069 420.4055
## [259,] 638.9689 419.8840
## [260,] 632.0250 416.7505
## [261,] 625.7986 413.4625
## [262,] 631.9531 414.2685
## [263,] 632.1552 411.1705
## [264,] 639.8601 411.0210
## [265,] 641.0077 403.4350
## [266,] 637.5891 401.2055
## [267,] 637.2432 400.3325
## [268,] 636.0182 397.1535
## [269,] 638.1076 394.5170
## [270,] 641.8518 389.9000
## [271,] 642.5694 382.0995
## [272,] 647.1454 375.4370
## [273,] 646.8206 367.5350
## [274,] 642.3979 361.2270
## [275,] 646.7943 355.1195
## [276,] 651.9535 349.3295
## [277,] 655.3323 342.2190
## [278,] 660.2071 335.8645
## [279,] 666.5561 330.8000
## [280,] 668.4643 324.3340
## [281,] 671.0554 317.3560
## [282,] 674.7494 310.5265
## [283,] 682.0681 307.0365
## [284,] 678.8675 300.0215
## [285,] 676.1265 292.5305
## [286,] 672.4816 285.4165
## [287,] 670.7031 277.6250
## [288,] 672.0626 269.8635
## [289,] 679.6031 267.0335
## [290,] 686.3326 269.9630
## [291,] 694.1704 269.5365
## [292,] 700.4034 273.5760
## [293,] 707.0869 269.0900
## [294,] 715.0551 269.7430
## [295,] 722.8026 269.0615
## [296,] 730.2461 267.9115
## [297,] 738.1657 267.6705
## [298,] 745.0838 267.2245
## [299,] 751.1460 261.5795
## [300,] 748.6172 255.2725
## [301,] 746.6788 247.9015
## [302,] 746.0246 240.0395
## [303,] 742.9088 232.6730
## [304,] 745.7926 226.0275
## [305,] 750.4721 222.8040
## [306,] 754.7605 230.0960
## [307,] 756.9620 237.0400
## [308,] 764.1136 239.5450
## [309,] 766.4169 247.0055
## [310,] 773.6025 246.4635
## [311,] 779.5244 241.7370
## [312,] 780.5477 235.9740
## [313,] 781.2457 228.9060
## [314,] 782.1244 221.1565
## [315,] 785.8440 214.5615
## [316,] 786.4940 208.1565
## [317,] 793.2052 204.8215
## [318,] 798.6256 205.2660
## [319,] 793.3366 199.1955
## [320,] 788.1348 193.1330
## [321,] 783.1404 186.8895
## [322,] 779.3786 180.5855
## [323,] 777.6838 187.1080
## [324,] 780.6988 194.3860
## [325,] 787.1432 199.1010
## [326,] 779.6488 198.6915
## [327,] 772.6134 194.9210
## [328,] 769.1531 197.2955
## [329,] 769.2277 205.3040
## [330,] 765.9299 200.5630
## [331,] 763.4193 199.8925
## [332,] 758.9433 205.2320
## [333,] 758.8034 196.9885
## [334,] 755.0248 193.7480
## [335,] 758.6353 188.6695
## [336,] 755.8891 181.1865
## [337,] 749.7261 182.4225
## [338,] 741.6741 182.3550
## [339,] 735.9467 185.6640
## [340,] 729.9425 190.3340
## [341,] 729.9480 185.5790
## [342,] 732.5398 179.1570
## [343,] 724.3474 179.7060
## [344,] 732.0773 177.3260
## [345,] 739.4257 175.5195
## [346,] 747.2383 176.2825
## [347,] 749.8156 172.8805
## [348,] 757.0451 171.5365
## [349,] 765.3682 170.5720
## [350,] 761.7008 165.0840
## [351,] 756.4854 159.1015
## [352,] 752.3797 152.2355
## [353,] 748.7319 145.1195
## [354,] 744.8536 138.1080
## [355,] 738.4984 141.5515
## [356,] 733.3784 139.6830
## [357,] 731.4422 135.9955
## [358,] 739.6543 136.1905
## [359,] 743.9527 133.0440
## [360,] 740.5862 125.3875
## [361,] 734.3525 126.2080
## [362,] 726.7563 124.2705
## [363,] 718.7597 124.5610
## [364,] 710.7634 124.8235
## [365,] 702.8644 124.1220
## [366,] 695.9013 121.1025
## [367,] 688.0460 122.3335
## [368,] 680.3679 121.7645
## [369,] 670.2049 111.7610
## 
## $loci.paper
##         [,1]    [,2]
## [1,] 300.336 484.453
## [2,] 647.755 317.463
## [3,] 361.764 438.781
## [4,] 410.100 260.373
data.frame(cbind(parana$coords, Rainfall = parana$data))
##         east     north Rainfall
## 1   402.9529 164.52841   306.09
## 2   501.7049 428.77100   200.88
## 3   556.3262 445.27065   167.07
## 4   573.4043 447.04177   162.77
## 5   702.4228 272.29590   163.57
## 6   668.5442 261.67070   178.61
## 7   435.8477 286.54044   301.54
## 8   434.0125 317.90506   282.07
## 9   432.4622 288.37001   319.12
## 10  162.1458 286.29984   244.67
## 11  169.4766 334.53158   233.31
## 12  717.8468 181.56741   224.46
## 13  713.3433 214.88336   206.12
## 14  726.6630 207.27952   248.99
## 15  618.4688 127.43265   237.87
## 16  661.8808 128.81455   222.87
## 17  506.7167 212.86691   263.10
## 18  561.7874 138.89773   236.91
## 19  585.6395 212.59809   247.01
## 20  531.7106 131.62153   240.58
## 21  308.9718 181.97682   304.28
## 22  306.1047 148.69468   351.73
## 23  150.1220 162.12624   277.92
## 24  155.3399 154.86652   323.08
## 25  620.0018 112.64927   253.32
## 26  475.0577  83.64484   315.33
## 27  366.8719  92.21224   379.94
## 28  479.4953 461.96806   197.09
## 29  615.7235 400.63795   199.91
## 30  599.0729 456.12037   167.00
## 31  566.5676 445.22857   182.88
## 32  484.6613 423.22788   197.10
## 33  445.5438 400.99330   257.50
## 34  498.2953 426.92592   205.16
## 35  477.9447 356.79285   224.07
## 36  353.1834 446.50166   212.50
## 37  338.5246 381.74695   242.08
## 38  267.2320 373.39454   247.79
## 39  676.8785 254.18138   187.27
## 40  538.8900 308.77851   222.54
## 41  340.9647 271.01967   313.60
## 42  203.9369 309.41998   269.92
## 43  254.2625 240.19632   321.69
## 44  719.4624 177.84707   208.89
## 45  768.5087 199.12352   238.62
## 46  721.6547 209.20941   248.76
## 47  687.7536 187.56295   193.48
## 48  599.0604 210.66083   240.48
## 49  541.8933 185.11924   265.56
## 50  449.6865 196.16437   302.13
## 51  357.5152 188.11980   335.41
## 52  222.3395 154.59123   330.87
## 53  297.3230 176.26524   329.49
## 54  184.1727 211.03701   262.81
## 55  401.9894  70.37282   365.88
## 56  365.3621  77.42565   359.08
## 57  331.6807 110.26775   344.59
## 58  294.9501 113.43465   366.10
## 59  674.3159 185.89772   201.84
## 60  518.6908 378.94032   218.27
## 61  562.7977 362.20880   200.38
## 62  399.9123 354.61628   229.40
## 63  309.6951 375.85998   235.07
## 64  308.2159 359.22457   236.25
## 65  397.5989 443.18080   228.82
## 66  206.2979 359.35560   258.12
## 67  289.3800 370.04023   232.17
## 68  246.8030 374.89923   248.17
## 69  279.5530 345.88871   240.66
## 70  231.8296 450.35979   184.59
## 71  245.5946 445.05926   165.46
## 72  410.8090 242.10715   320.31
## 73  400.0153 339.85273   232.80
## 74  405.1119 338.04194   266.27
## 75  422.4753 262.48003   301.10
## 76  457.7338 306.92340   244.78
## 77  388.4718 299.16275   248.57
## 78  299.0782 285.24334   299.00
## 79  320.4695 329.84407   269.49
## 80  317.7274 279.96009   300.89
## 81  328.1532 256.09127   311.81
## 82  341.9647 271.01967   317.34
## 83  346.0594 313.53010   286.93
## 84  371.7581 278.71589   306.64
## 85  377.0997 247.38436   349.09
## 86  395.4668 267.83959   289.11
## 87  244.7930 297.28745   280.49
## 88  232.0861 343.23287   237.11
## 89  212.3630 311.44174   269.68
## 90  250.9284 238.28897   307.47
## 91  249.1147 339.84732   253.57
## 92  262.9887 321.61570   226.71
## 93  264.8356 312.41223   299.69
## 94  277.1810 281.21777   266.62
## 95  267.4829 255.20257   331.46
## 96  287.4249 273.99100   270.67
## 97  291.2186 246.34864   321.15
## 98  296.5940 340.60144   258.20
## 99  295.1108 325.80878   288.85
## 100 211.6614 263.38789   255.76
## 101 189.3152 281.38550   264.77
## 102 165.9700 267.90686   271.76
## 103 164.2818 267.86614   313.63
## 104 184.9871 323.79426   252.94
## 105 711.8998 124.40728   246.75
## 106 749.5943 175.47115   215.95
## 107 702.7330 179.95796   299.71
## 108 650.7635 178.79807   203.40
## 109 640.7307 180.75360   209.47
## 110 600.6570 199.57391   185.63
## 111 421.2830 177.57037   304.30
## 112 451.4439 174.02255   320.05
## 113 419.3326 223.70296   273.01
## 114 377.7171 179.08881   295.62
## 115 357.4957 189.96577   334.95
## 116 372.2726 223.34289   350.18
## 117 287.3583 170.56964   291.35
## 118 285.6835 170.54282   319.57
## 119 224.3215 139.84991   367.32
## 120 218.9926 154.52067   332.04
## 121 262.6645 146.13850   332.18
## 122 217.2403 158.17924   323.82
## 123 212.6301 217.21353   334.22
## 124 249.3585 142.19763   345.33
## 125 245.9086 147.67415   345.24
## 126 251.2398 131.14844   383.13
## 127 197.7439 205.80201   348.67
## 128 172.8530 192.28300   282.54
## 129 187.8333 198.18379   291.07
## 130 568.3420 114.86877   245.42
## 131 541.6892 120.51877   291.63
## 132 493.3411  98.43402   288.50
## 133 471.6876 103.94229   314.65
## 134 445.0324 105.70264   331.85
## 135 479.9921 118.72419   305.43
## 136 333.2294 119.52053   285.05
## 137 400.3281  70.36000   359.51
## 138 343.6607  84.56600   356.82
## 139 320.2432  93.49421   372.56
## 140 331.8482  97.34366   413.70
## 141 235.3269  92.03407   412.44
## 142 226.5333 114.02601   400.96
## 143 692.5446 170.87504   199.37
ggplot(data.frame(cbind(parana$coords, Rainfall = parana$data)))+
  geom_point(aes(east, north, color = Rainfall), size = 2) +
  coord_fixed(ratio = 1) +
  scale_color_gradient(low = "blue", high = "orange") +
  geom_path(data = data.frame(parana$border), aes(east, north)) +
  labs(title="Average rainfall measurements",
       subtitle="May-June Paraná state, Brazil")+
  theme_bw()

2.1.1.3 Point patterns

The domain \(D\) in point patterns is random.

rng <- cholera::mapRange()


plot(fatalities[, c("x", "y")],
  pch = 15, col = "black",
  cex = 0.5, xlim = rng$x, ylim = rng$y, 
  asp = 1,main="The locations of deaths\nof the 1854 London cholera outbreak",
  frame.plot = FALSE, 
  axes = FALSE, xlab = "", ylab = ""
)
addRoads()

# ?cholera::addRoads()