Calculates the predicted abundance by multiplying the density prediction values by prediction polygon areas
Value
If sum.abund == TRUE
, then a vector of the same length as dens.idx
representing the predicted abundance for the density values in each column.
If sum.abund == FALSE
and the length of dens.idx
is 1,
then a numeric vector with the predicted abundance of each prediction polygon of x
.
If sum.abund == FALSE
and the length of dens.idx
is greater than 1,
then a data frame with length(dens.idx)
columns of the predicted abundance of prediction polygons
Details
Multiplies the values in the specified column(s) (i.e. the density predictions)
by the area in square kilometers of their corresponding prediction polygon.
The area of each prediction polygon is calculated using st_area
from geos_measures
.
x must have a valid crs code to calculate area for these abundance calculations.
Examples
model_abundance(preds.1, "Density")
#> Density
#> 113232.1
model_abundance(preds.1, c(1, 1))
#> [1] 113232.1 113232.1
model_abundance(preds.1, c(1, 1), FALSE)
#> 1.abund 1.abund
#> 1 29.380042 29.380042
#> 2 8.801462 8.801462
#> 3 19.760931 19.760931
#> 4 8.338632 8.338632
#> 5 10.114850 10.114850
#> 6 12.461019 12.461019
#> 7 6.064823 6.064823
#> 8 7.259058 7.259058
#> 9 10.457556 10.457556
#> 10 35.528634 35.528634
#> 11 58.980966 58.980966
#> 12 27.193733 27.193733
#> 13 15.162191 15.162191
#> 14 21.140346 21.140346
#> 15 223.987397 223.987397
#> 16 375.975817 375.975817
#> 17 418.267150 418.267150
#> 18 501.693896 501.693896
#> 19 345.753660 345.753660
#> 20 116.235967 116.235967
#> 21 331.549944 331.549944
#> 22 435.379325 435.379325
#> 23 584.785273 584.785273
#> 24 640.362099 640.362099
#> 25 248.658012 248.658012
#> 26 49.120724 49.120724
#> 27 51.353557 51.353557
#> 28 21.130448 21.130448
#> 29 18.536482 18.536482
#> 30 14.267988 14.267988
#> 31 14.665388 14.665388
#> 32 33.444843 33.444843
#> 33 25.682155 25.682155
#> 34 59.543802 59.543802
#> 35 102.139409 102.139409
#> 36 162.003138 162.003138
#> 37 31.567839 31.567839
#> 38 60.792942 60.792942
#> 39 440.005881 440.005881
#> 40 978.828473 978.828473
#> 41 970.317661 970.317661
#> 42 959.576708 959.576708
#> 43 1076.442113 1076.442113
#> 44 526.980160 526.980160
#> 45 492.093378 492.093378
#> 46 500.778242 500.778242
#> 47 1178.278788 1178.278788
#> 48 1266.595181 1266.595181
#> 49 831.628443 831.628443
#> 50 724.295455 724.295455
#> 51 48.423360 48.423360
#> 52 22.295281 22.295281
#> 53 13.507420 13.507420
#> 54 13.379502 13.379502
#> 55 7.992948 7.992948
#> 56 13.302392 13.302392
#> 57 4.609331 4.609331
#> 58 42.006974 42.006974
#> 59 53.911134 53.911134
#> 60 134.721655 134.721655
#> 61 278.000058 278.000058
#> 62 62.138648 62.138648
#> 63 767.120262 767.120262
#> 64 1022.332185 1022.332185
#> 65 1099.977261 1099.977261
#> 66 1319.306666 1319.306666
#> 67 1264.580888 1264.580888
#> 68 1025.781614 1025.781614
#> 69 1074.996881 1074.996881
#> 70 568.203313 568.203313
#> 71 463.107393 463.107393
#> 72 846.578824 846.578824
#> 73 1007.831360 1007.831360
#> 74 1395.035148 1395.035148
#> 75 NA NA
#> 76 49.212475 49.212475
#> 77 14.911804 14.911804
#> 78 5.148820 5.148820
#> 79 4.751022 4.751022
#> 80 16.470810 16.470810
#> 81 22.149293 22.149293
#> 82 6.200892 6.200892
#> 83 63.827365 63.827365
#> 84 183.396771 183.396771
#> 85 333.697073 333.697073
#> 86 75.974646 75.974646
#> 87 660.710544 660.710544
#> 88 1137.094612 1137.094612
#> 89 1257.932145 1257.932145
#> 90 1177.211844 1177.211844
#> 91 1373.445558 1373.445558
#> 92 1051.430914 1051.430914
#> 93 1099.757383 1099.757383
#> 94 619.586870 619.586870
#> 95 644.800174 644.800174
#> 96 1021.594018 1021.594018
#> 97 1004.579364 1004.579364
#> 98 1199.583989 1199.583989
#> 99 NA NA
#> 100 NA NA
#> 101 100.022657 100.022657
#> 102 20.635956 20.635956
#> 103 2.824256 2.824256
#> 104 2.987275 2.987275
#> 105 8.516881 8.516881
#> 106 28.702889 28.702889
#> 107 68.487057 68.487057
#> 108 160.860509 160.860509
#> 109 49.637587 49.637587
#> 110 232.696212 232.696212
#> 111 351.478354 351.478354
#> 112 1373.818991 1373.818991
#> 113 1253.029767 1253.029767
#> 114 993.052475 993.052475
#> 115 1105.857212 1105.857212
#> 116 835.864881 835.864881
#> 117 1208.419795 1208.419795
#> 118 800.214380 800.214380
#> 119 601.473113 601.473113
#> 120 1132.563715 1132.563715
#> 121 1252.130124 1252.130124
#> 122 1364.994320 1364.994320
#> 123 1338.141997 1338.141997
#> 124 NA NA
#> 125 NA NA
#> 126 93.047013 93.047013
#> 127 31.513009 31.513009
#> 128 1.278419 1.278419
#> 129 1.442568 1.442568
#> 130 11.104454 11.104454
#> 131 58.667886 58.667886
#> 132 125.421544 125.421544
#> 133 76.570231 76.570231
#> 134 106.446194 106.446194
#> 135 196.353341 196.353341
#> 136 1026.383055 1026.383055
#> 137 1202.606515 1202.606515
#> 138 1066.236304 1066.236304
#> 139 1053.705248 1053.705248
#> 140 NA NA
#> 141 625.572900 625.572900
#> 142 794.363420 794.363420
#> 143 1136.983703 1136.983703
#> 144 1055.066502 1055.066502
#> 145 1198.866303 1198.866303
#> 146 1423.354324 1423.354324
#> 147 1412.950043 1412.950043
#> 148 1287.174988 1287.174988
#> 149 NA NA
#> 150 NA NA
#> 151 73.927155 73.927155
#> 152 40.608258 40.608258
#> 153 3.911921 3.911921
#> 154 4.826559 4.826559
#> 155 29.511036 29.511036
#> 156 29.090951 29.090951
#> 157 79.000370 79.000370
#> 158 184.715596 184.715596
#> 159 149.972945 149.972945
#> 160 220.692526 220.692526
#> 161 1278.343687 1278.343687
#> 162 862.485401 862.485401
#> 163 668.024648 668.024648
#> 164 703.981623 703.981623
#> 165 538.206654 538.206654
#> 166 807.861409 807.861409
#> 167 1129.229716 1129.229716
#> 168 1213.738385 1213.738385
#> 169 1323.688759 1323.688759
#> 170 1388.788602 1388.788602
#> 171 1429.053497 1429.053497
#> 172 NA NA
#> 173 NA NA
#> 174 NA NA
#> 175 NA NA
#> 176 118.826135 118.826135
#> 177 18.126000 18.126000
#> 178 15.503924 15.503924
#> 179 14.565953 14.565953
#> 180 35.863013 35.863013
#> 181 110.352073 110.352073
#> 182 124.998841 124.998841
#> 183 28.674313 28.674313
#> 184 31.210789 31.210789
#> 185 92.093086 92.093086
#> 186 259.011161 259.011161
#> 187 684.888184 684.888184
#> 188 993.540657 993.540657
#> 189 639.701251 639.701251
#> 190 658.528890 658.528890
#> 191 1065.183102 1065.183102
#> 192 1277.160231 1277.160231
#> 193 1361.309875 1361.309875
#> 194 1182.433710 1182.433710
#> 195 NA NA
#> 196 NA NA
#> 197 NA NA
#> 198 NA NA
#> 199 NA NA
#> 200 NA NA
#> 201 123.686550 123.686550
#> 202 145.158254 145.158254
#> 203 48.059915 48.059915
#> 204 60.376694 60.376694
#> 205 81.531444 81.531444
#> 206 108.482756 108.482756
#> 207 63.794913 63.794913
#> 208 20.424917 20.424917
#> 209 33.365174 33.365174
#> 210 88.599356 88.599356
#> 211 299.001466 299.001466
#> 212 NA NA
#> 213 1399.331236 1399.331236
#> 214 NA NA
#> 215 1201.343099 1201.343099
#> 216 1146.204760 1146.204760
#> 217 900.185848 900.185848
#> 218 739.162367 739.162367
#> 219 1332.832473 1332.832473
#> 220 NA NA
#> 221 NA NA
#> 222 NA NA
#> 223 NA NA
#> 224 NA NA
#> 225 NA NA
#> 226 148.446050 148.446050
#> 227 277.553154 277.553154
#> 228 97.285115 97.285115
#> 229 90.077503 90.077503
#> 230 139.699024 139.699024
#> 231 102.850340 102.850340
#> 232 18.272389 18.272389
#> 233 44.728180 44.728180
#> 234 92.015905 92.015905
#> 235 579.437580 579.437580
#> 236 829.655848 829.655848
#> 237 1192.986975 1192.986975
#> 238 1302.456927 1302.456927
#> 239 1383.676632 1383.676632
#> 240 1399.189922 1399.189922
#> 241 NA NA
#> 242 NA NA
#> 243 NA NA
#> 244 NA NA
#> 245 NA NA
#> 246 NA NA
#> 247 NA NA
#> 248 NA NA
#> 249 NA NA
#> 250 NA NA
#> 251 219.868683 219.868683
#> 252 253.205760 253.205760
#> 253 161.427434 161.427434
#> 254 233.535451 233.535451
#> 255 164.052272 164.052272
#> 256 30.900163 30.900163
#> 257 83.103166 83.103166
#> 258 108.881843 108.881843
#> 259 229.842418 229.842418
#> 260 356.776908 356.776908
#> 261 NA NA
#> 262 NA NA
#> 263 NA NA
#> 264 NA NA
#> 265 NA NA
#> 266 NA NA
#> 267 NA NA
#> 268 NA NA
#> 269 NA NA
#> 270 NA NA
#> 271 NA NA
#> 272 NA NA
#> 273 NA NA
#> 274 NA NA
#> 275 NA NA
#> 276 221.746551 221.746551
#> 277 332.734815 332.734815
#> 278 213.490583 213.490583
#> 279 243.151612 243.151612
#> 280 63.738572 63.738572
#> 281 147.348113 147.348113
#> 282 700.197309 700.197309
#> 283 972.696869 972.696869
#> 284 534.312367 534.312367
#> 285 632.582664 632.582664
#> 286 NA NA
#> 287 NA NA
#> 288 NA NA
#> 289 NA NA
#> 290 NA NA
#> 291 NA NA
#> 292 NA NA
#> 293 NA NA
#> 294 NA NA
#> 295 NA NA
#> 296 NA NA
#> 297 NA NA
#> 298 NA NA
#> 299 NA NA
#> 300 NA NA
#> 301 96.688439 96.688439
#> 302 132.608850 132.608850
#> 303 57.546168 57.546168
#> 304 47.263826 47.263826
#> 305 10.730766 10.730766
#> 306 144.233802 144.233802
#> 307 295.345601 295.345601
#> 308 593.924674 593.924674
#> 309 388.085391 388.085391
#> 310 273.103934 273.103934
#> 311 NA NA
#> 312 NA NA
#> 313 NA NA
#> 314 NA NA
#> 315 NA NA
#> 316 NA NA
#> 317 NA NA
#> 318 NA NA
#> 319 NA NA
#> 320 NA NA
#> 321 NA NA
#> 322 NA NA
#> 323 NA NA
#> 324 NA NA
#> 325 NA NA