unexpected behaviour in mt_set_track_id()
Hi @bartk, we got the feedback that many moveapp users would like to have their trackIDs assigned to the animal name (currently it is always animalName_deploymentID). So we want to give the option to the user when they download data to decide if they want the tracks to have the track id defined by animal name, deployment id or animalName_deploymentID. While testing some stuff, I realizes something odd is happening. I guess it has to to with the changes done in the mt_stack to the track data table: The track summary above gets repeated, and as many repetitions, there are track data tables.... The study is my MB study to test stuff on, you should have access. I removed most of the print, just kept the "to make a point" parts
In the documentation of the mt_set_track_id() it says: "To set a new column defining the track ids, this column has to be present in the event table." But it seems that it also works when the column is only present in the track data table, like in the first example here. Did you change this recently?
library(move2)
locs1 <- movebank_download_study(571846928)
#> ℹ In total 8 records were omitted as they were not deployed (the
#> `deployment_id` was `NA`).
locs2 <- mt_set_track_id(locs1, "individual_local_identifier")
locs2
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 3 tracks lasting on average 4.15 hours in a
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 3 tracks lasting on average 4.15 hours in a
#> Simple feature collection with 125 features and 36 fields (with 1 geometry empty)
# ...
#> # A tibble: 125 × 37
#> deployment_id sensor_type_id algorithm_marked_outlier barometric_pressure
#> <int64> <int64> <lgl> [mbar]
#> 1 571857894 653 NA NA
# ...
#> Track features:
#> # A tibble: 3 × 43
#> individual_local_ide…¹ tag_id individual_id animal_life_stage attachment_type
#> <fct> <named> <named list> <named list> <named list>
#> 1 indivA <int64> <int64 [1]> <fct [1]> <fct [1]>
# ...
#> Track features:
#> # A tibble: 3 × 43
# ...
locs3 <- mt_set_track_id(locs2, "deployment_id")
locs3
#> A <move2> with `track_id_column` "deployment_id" and `time_column` "timestamp"
#> Containing 4 tracks lasting on average 3.1 hours in a
#> A <move2> with `track_id_column` "deployment_id" and `time_column` "timestamp"
#> Containing 4 tracks lasting on average 3.1 hours in a
#> A <move2> with `track_id_column` "deployment_id" and `time_column` "timestamp"
#> Containing 4 tracks lasting on average 3.1 hours in a
#> A <move2> with `track_id_column` "deployment_id" and `time_column` "timestamp"
#> Containing 4 tracks lasting on average 3.1 hours in a
#> Simple feature collection with 125 features and 36 fields (with 1 geometry empty)
# ...
#> # A tibble: 125 × 37
#> deployment_id sensor_type_id algorithm_marked_outlier barometric_pressure
#> <int64> <int64> <lgl> [mbar]
#> 1 571857894 653 NA NA
# ...
#> Track features:
#> # A tibble: 4 × 43
#> deployment_id tag_id individual_id animal_life_stage attachment_type
#> <int64> <named list> <named list> <named list> <named list>
#> 1 3579237129 <int64 [2]> <int64 [2]> <fct [2]> <fct [2]>
# ...
#> Track features:
#> # A tibble: 4 × 43
# ...
#> Track features:
#> # A tibble: 4 × 43
# ...
#> Track features:
#> # A tibble: 4 × 43
# ...
locs4 <- mt_set_track_id(locs3, "individual_local_identifier")
locs4
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 3 tracks lasting on average 4.15 hours in a
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 3 tracks lasting on average 4.15 hours in a
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 3 tracks lasting on average 4.15 hours in a
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 3 tracks lasting on average 4.15 hours in a
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 3 tracks lasting on average 4.15 hours in a
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 3 tracks lasting on average 4.15 hours in a
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 3 tracks lasting on average 4.15 hours in a
#> A <move2> with `track_id_column` "individual_local_identifier" and
#> `time_column` "timestamp"
#> Containing 3 tracks lasting on average 4.15 hours in a
#> Simple feature collection with 125 features and 36 fields (with 1 geometry empty)
# ...
#> # A tibble: 125 × 37
#> deployment_id sensor_type_id algorithm_marked_outlier barometric_pressure
#> <int64> <int64> <lgl> [mbar]
#> 1 571857894 653 NA NA
# ...
#> Track features:
#> # A tibble: 3 × 43
#> individual_local_identifier tag_id individual_id animal_life_stage
#> <fct> <named list> <named list> <named list>
#> 1 indivA <named list [1]> <named list> <named list [1]>
# ...
#> Track features:
#> # A tibble: 3 × 43
# ...
#> Track features:
#> # A tibble: 3 × 43
# ...
#> Track features:
#> # A tibble: 3 × 43
# ...
#> Track features:
#> # A tibble: 3 × 43
# ...
#> Track features:
#> # A tibble: 3 × 43
# ...
#> Track features:
#> # A tibble: 3 × 43
# ...
#> Track features:
#> # A tibble: 3 × 43
# ...
Created on 2024-04-06 with reprex v2.1.0