You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What I would like to find out is whether there are any records of users that are <= 5 minutes apart from a record of another user (and also colocated, but let's leave that out for the moment)
The spatsoc way would be to slice the datetime into 5 minute pieces and see if records fall into those.
datetime user minutes imegroup
1: 2019-06-01 00:00:01 A 0 1
2: 2019-06-01 00:01:38 A 0 1
3: 2019-06-01 00:05:49 A 5 2
4: 2019-06-01 00:06:01 A 5 2
5: 2019-06-01 00:07:59 A 5 2
6: 2019-06-01 00:11:04 B 10 3
This, however, puts rows 5 and 6 into different groups — although their observations are within the defined threshold. So, in the end, I would rather like to get something like
datetime user timegroup
1: 2019-06-01 00:07:59 A 1
2: 2019-06-01 00:11:04 B 1
or even
ego_datetime ego_user alter_datetime alter_user
1: 2019-06-01 00:07:59 A 2019-06-01 00:11:04 B
Are there any plans to do something like this? Or maybe I've missed something in the library?
There are robust methods to deal with that type of stuff, but they are quite brute-force (copious use of left joins...) and maybe / probably there is a more efficient way.
The text was updated successfully, but these errors were encountered:
Hey @RomanAbashin,
The reason spatsoc was developed to work with the logic of "nearest to a fixed interval" is because animal GPS data is often collected on a fixed interval. I really appreciate your recent questions because it's helping to push the package to fit a broader and more complete application! (Thanks)
Having that in mind, would maybe something like a time_dist make sense for #18
The challenge I see if we try and apply this within 5 minutes without a fixed interval, is when it comes to building a network or using the downstream spatsoc functions. Functions like group_pts and group_lines use the timegroups, to take chunks of the larger data and measure distance between points or spatial overlap of lines. By using an individual-centric time grouping as opposed to a fixed interval, it scrambles the way we take these chunks (as spatsoc is designed right now).
A time_dist (likely edge_time) type function similar to edge_dist would be really neat because we'd be able to combine temporal and spatial edge-lists, that follow a similar workflow as group_times and group_pts. This way, we wouldn't need to alter the current group_* functions.
I have some ideas (a two-pass group_times and the wonderful data.table::foverlaps), I'll keep you posted.
Hi @robitalec ,
let's take the following case
What I would like to find out is whether there are any records of users that are <= 5 minutes apart from a record of another user (and also colocated, but let's leave that out for the moment)
The
spatsoc
way would be to slice the datetime into 5 minute pieces and see if records fall into those.Result
This, however, puts rows 5 and 6 into different groups — although their observations are within the defined threshold. So, in the end, I would rather like to get something like
or even
Are there any plans to do something like this? Or maybe I've missed something in the library?
There are robust methods to deal with that type of stuff, but they are quite brute-force (copious use of left joins...) and maybe / probably there is a more efficient way.
The text was updated successfully, but these errors were encountered: