ocean-tracking-network / glatos

9 stars 3 forks source link

Does glatos::min_lag require ordered detections? #118

Open jdpye opened 2 years ago

jdpye commented 2 years ago

In GitLab by @bdelo on Mar 12, 2020, 09:57

If so, should we be ordering them when the function gets called?

jdpye commented 2 years ago

In GitLab by @chrisholbrook on Mar 12, 2020, 10:35

min_lag (1) sorts the input data by by transmitter_codespace, transmitter_id, receiver_sn, and detection_timestamp_utc (in that order); (2) computes min_lag separately for each combination of transmitter_codespace, transmitter_id, and receiver_sn (thus, sorted by detection_timestamp_utc in each group); and (3) restores original (input) order.

data.table::setkey is used to specify row order for calculations, e.g.

  data.table::setkey(dtc, transmitter_codespace, transmitter_id, receiver_sn, 
    detection_timestamp_utc)
jdpye commented 2 years ago

In GitLab by @chrisholbrook on Mar 12, 2020, 10:38

So there is no need to order detections when the function is called. This needs to be added to help("min_lag"). I will leave this issue open until that is done.