A cleaned movement track of one individual at a time can be classified into
residence patches using the
function atl_res_patch.
The function expects a specific organisation of the data: there should be
at least the following columns, x, y, and time,
corresponding to the coordinates, and the time as POSIXct.
atl_res_patch requires only three parameters: (1) the maximum
speed threshold between localizations (called max_speed), (2) the
distance threshold between proto-patches of positions (called
lim_spat_indep), and (3) the time interval between proto-patches
(called lim_time_indep). As the code initially only looks at
proto-patches, at the end it checks if positions within patches are
interrupted by short flights (with a distance larger than
lim_spat_indep to the last position of the proto-patch before and
first position of the next proto-patch). If there are more than
min_fixes in this bout, then the patch will be split. If there are
less, we assume this to be single outliers and only assign no patch ID
Usage
atl_res_patch(
data,
max_speed = 3,
lim_spat_indep = 75,
lim_time_indep = 180,
min_fixes = 2,
min_duration = 60
)Arguments
- data
A dataframe of any class that is or extends data.frame of one individual only. The dataframe must contain at least two spatial coordinates,
xandy, and a temporal coordinate,time.- max_speed
A numeric value specifying the maximum speed (m/s) between two coordinates that would be considered non-transitory
- lim_spat_indep
A numeric value of distance in metres of the spatial distance between two patches for them to the considered independent.
- lim_time_indep
A numeric value of time in minutes of the time difference between two patches for them to be considered independent.
- min_fixes
The minimum number of fixes for a group of spatially-proximate number of points to be considered a preliminary residence patch.
- min_duration
The minimum duration (in seconds) for classifying residence patches.
Examples
# packages
library(tools4watlas)
# load example data
data <- data_example
# calculate residence patches for one red knot
data <- atl_res_patch(
data[tag == "3038"],
max_speed = 3, lim_spat_indep = 75, lim_time_indep = 180,
min_fixes = 2, min_duration = 60
)
# summary of residence patches
data_summary <- atl_res_patch_summary(data)
data_summary
#> tag patch nfixes x_mean x_median x_start x_end y_mean y_median
#> <char> <char> <int> <num> <num> <num> <num> <num> <num>
#> 1: 3038 1 1039 650119.8 650143.7 650120.1 649921.5 5902387 5902399
#> 2: 3038 2 958 650378.5 650378.6 650369.7 650384.2 5902349 5902368
#> 3: 3038 3 831 650263.3 650251.5 650254.9 650313.1 5902162 5902170
#> 4: 3038 4 354 650472.8 650457.9 650403.8 650534.6 5901982 5901997
#> 5: 3038 5 1034 650763.1 650765.2 650722.6 650729.8 5901920 5901904
#> 6: 3038 6 426 650805.2 650798.7 650859.0 650766.6 5901891 5901893
#> 7: 3038 7 163 650739.1 650739.3 650739.5 650738.8 5901747 5901747
#> 8: 3038 8 610 650664.2 650676.0 650696.8 650616.4 5901843 5901844
#> 9: 3038 9 1173 650971.4 650995.1 651071.8 650865.5 5901981 5901988
#> 10: 3038 10 1440 650728.6 650728.2 650773.4 650713.5 5901998 5902007
#> 11: 3038 11 85 650883.8 650881.6 650895.4 650871.3 5902117 5902115
#> 12: 3038 12 368 651515.0 651539.5 651555.4 651428.1 5902163 5902143
#> 13: 3038 13 115 651406.1 651402.6 651422.3 651401.5 5902383 5902381
#> 14: 3038 14 68 651429.5 651430.3 651423.4 651436.1 5902535 5902532
#> 15: 3038 15 115 651499.6 651501.2 651457.8 651499.6 5903028 5903027
#> 16: 3038 16 2 651254.8 651254.8 651254.8 651254.8 5902959 5902959
#> 17: 3038 17 6 650945.7 650927.1 651025.0 650917.5 5902941 5902940
#> 18: 3038 18 3 650605.3 650605.3 650605.3 650605.3 5903017 5903006
#> 19: 3038 19 4 650681.9 650670.3 650716.7 650670.3 5903107 5903107
#> 20: 3038 20 4 651668.5 651668.5 651668.5 651668.5 5903164 5903148
#> 21: 3038 21 8 651621.9 651622.0 651626.9 651618.4 5902819 5902819
#> 22: 3038 22 3 651686.5 651686.5 651686.5 651686.5 5902868 5902868
#> 23: 3038 23 294 650211.9 650222.3 650216.9 650211.5 5902178 5902191
#> 24: 3038 24 158 650062.5 650063.6 650053.1 650055.9 5902047 5902043
#> 25: 3038 25 1018 650232.6 650236.4 650180.9 650257.9 5902030 5902023
#> 26: 3038 26 81 650422.0 650421.3 650416.9 650430.5 5901725 5901723
#> 27: 3038 27 3038 650572.6 650547.5 650608.5 650317.2 5902113 5902115
#> 28: 3038 28 1072 650155.0 650155.0 650153.7 650159.1 5902363 5902361
#> tag patch nfixes x_mean x_median x_start x_end y_mean y_median
#> <char> <char> <int> <num> <num> <num> <num> <num> <num>
#> y_start y_end time_mean time_median time_start
#> <num> <num> <POSc> <POSc> <POSc>
#> 1: 5902400 5902357 2023-09-23 01:39:27 2023-09-23 01:35:57 2023-09-23 01:00:03
#> 2: 5902387 5902293 2023-09-23 02:56:06 2023-09-23 02:56:39 2023-09-23 02:26:39
#> 3: 5902239 5902078 2023-09-23 03:49:21 2023-09-23 03:49:30 2023-09-23 03:24:03
#> 4: 5902046 5901906 2023-09-23 04:24:05 2023-09-23 04:24:01 2023-09-23 04:14:06
#> 5: 5902017 5901775 2023-09-23 05:04:49 2023-09-23 05:02:37 2023-09-23 04:35:08
#> 6: 5901867 5901884 2023-09-23 05:48:01 2023-09-23 05:47:55 2023-09-23 05:36:17
#> 7: 5901750 5901746 2023-09-23 06:04:21 2023-09-23 06:04:23 2023-09-23 05:59:56
#> 8: 5901821 5901854 2023-09-23 06:26:57 2023-09-23 06:26:54 2023-09-23 06:08:53
#> 9: 5901909 5902008 2023-09-23 07:18:55 2023-09-23 07:18:44 2023-09-23 06:45:11
#> 10: 5901939 5902044 2023-09-23 08:32:55 2023-09-23 08:33:09 2023-09-23 07:52:04
#> 11: 5902104 5902115 2023-09-23 09:16:10 2023-09-23 09:16:10 2023-09-23 09:13:40
#> 12: 5902122 5902261 2023-09-23 09:34:33 2023-09-23 09:31:17 2023-09-23 09:19:22
#> 13: 5902354 5902417 2023-09-23 10:03:57 2023-09-23 10:03:58 2023-09-23 10:00:16
#> 14: 5902509 5902565 2023-09-23 10:15:58 2023-09-23 10:15:53 2023-09-23 10:13:40
#> 15: 5903046 5903028 2023-09-23 11:10:51 2023-09-23 11:10:19 2023-09-23 10:26:40
#> 16: 5902963 5902955 2023-09-23 12:00:45 2023-09-23 12:00:45 2023-09-23 11:52:03
#> 17: 5902940 5902940 2023-09-23 12:44:22 2023-09-23 12:46:32 2023-09-23 12:32:27
#> 18: 5902993 5903051 2023-09-23 13:38:58 2023-09-23 13:47:06 2023-09-23 13:18:54
#> 19: 5903100 5903115 2023-09-23 14:09:47 2023-09-23 14:14:40 2023-09-23 13:54:57
#> 20: 5903143 5903217 2023-09-23 15:07:37 2023-09-23 15:07:02 2023-09-23 15:03:29
#> 21: 5902819 5902819 2023-09-23 15:17:47 2023-09-23 15:17:52 2023-09-23 15:17:11
#> 22: 5902868 5902868 2023-09-23 15:20:58 2023-09-23 15:19:53 2023-09-23 15:19:50
#> 23: 5902167 5902185 2023-09-23 15:44:08 2023-09-23 15:43:49 2023-09-23 15:35:35
#> 24: 5902079 5902018 2023-09-23 15:57:53 2023-09-23 15:57:40 2023-09-23 15:53:17
#> 25: 5902042 5902023 2023-09-23 16:39:38 2023-09-23 16:40:51 2023-09-23 16:04:11
#> 26: 5901726 5901741 2023-09-23 17:15:20 2023-09-23 17:15:17 2023-09-23 17:13:08
#> 27: 5901823 5902230 2023-09-23 19:41:13 2023-09-23 19:28:13 2023-09-23 17:17:59
#> 28: 5902362 5902391 2023-09-23 23:30:06 2023-09-23 23:30:15 2023-09-23 22:44:00
#> y_start y_end time_mean time_median time_start
#> <num> <num> <POSc> <POSc> <POSc>
#> time_end dist_start_end dist_in_patch dist_bw_patch
#> <POSc> <num> <num> <num>
#> 1: 2023-09-23 02:24:18 203.093945 1845.172537 NA
#> 2: 2023-09-23 03:23:33 95.183981 1172.579761 449.10828
#> 3: 2023-09-23 04:13:51 171.139566 724.395850 140.38571
#> 4: 2023-09-23 04:34:20 191.555615 349.044443 96.27647
#> 5: 2023-09-23 05:35:53 241.910148 1280.437829 218.34299
#> 6: 2023-09-23 05:59:38 94.007329 394.634875 158.80644
#> 7: 2023-09-23 06:08:41 3.606106 116.823319 136.99063
#> 8: 2023-09-23 06:44:26 87.212108 411.854211 85.36514
#> 9: 2023-09-23 07:51:46 228.708415 1032.202468 458.67406
#> 10: 2023-09-23 09:13:13 120.308727 1137.054849 114.83434
#> 11: 2023-09-23 09:18:37 26.517958 98.768135 191.48906
#> 12: 2023-09-23 09:59:34 188.146599 949.080795 684.17736
#> 13: 2023-09-23 10:07:58 66.914171 212.722517 92.91601
#> 14: 2023-09-23 10:18:22 56.954434 140.588243 94.28270
#> 15: 2023-09-23 11:25:39 45.630289 277.568692 481.80799
#> 16: 2023-09-23 12:09:27 8.219071 8.219071 253.10421
#> 17: 2023-09-23 12:47:36 107.521794 108.150466 230.26572
#> 18: 2023-09-23 13:50:54 58.628698 58.628698 316.52791
#> 19: 2023-09-23 14:14:51 48.732652 61.246854 121.63455
#> 20: 2023-09-23 15:12:53 74.045195 74.045195 998.55687
#> 21: 2023-09-23 15:18:23 8.514269 9.081978 400.94369
#> 22: 2023-09-23 15:23:11 0.000000 0.000000 84.09319
#> 23: 2023-09-23 15:52:50 18.739496 919.862345 1628.57203
#> 24: 2023-09-23 16:02:35 60.546290 250.967827 190.57924
#> 25: 2023-09-23 17:12:38 79.288671 945.792588 127.23215
#> 26: 2023-09-23 17:17:35 20.560332 85.590624 336.92942
#> 27: 2023-09-23 22:24:09 500.761579 3526.213616 195.76701
#> 28: 2023-09-23 23:59:54 29.822003 1197.758289 210.06924
#> time_end dist_start_end dist_in_patch dist_bw_patch
#> <POSc> <num> <num> <num>
#> time_bw_patch disp_in_patch duration
#> <num> <num> <num>
#> 1: NA 203.093945 5054.598
#> 2: 140.989 95.183981 3413.729
#> 3: 29.997 171.139566 2987.763
#> 4: 14.998 191.555615 1214.904
#> 5: 47.996 241.910148 3644.711
#> 6: 23.998 94.007329 1400.888
#> 7: 17.999 3.606106 524.959
#> 8: 11.999 87.212108 2132.830
#> 9: 44.997 228.708415 3995.684
#> 10: 17.999 120.308727 4868.615
#> 11: 26.998 26.517958 296.977
#> 12: 44.997 188.146599 2411.810
#> 13: 41.997 66.914171 461.963
#> 14: 341.973 56.954434 281.978
#> 15: 497.960 45.630289 3539.722
#> 16: 1583.876 8.219071 1043.918
#> 17: 1379.892 107.521794 908.929
#> 18: 1877.852 58.628698 1919.850
#> 19: 242.981 48.732652 1193.906
#> 20: 2918.771 74.045195 563.955
#> 21: 257.980 8.514269 71.994
#> 22: 86.993 0.000000 200.984
#> 23: 743.942 18.739496 1034.918
#> 24: 26.997 60.546290 557.956
#> 25: 95.993 79.288671 4106.673
#> 26: 29.998 20.560332 266.979
#> 27: 23.998 500.761579 18370.541
#> 28: 1190.905 29.822003 4553.638
#> time_bw_patch disp_in_patch duration
#> <num> <num> <num>
