I have multiple locations for each action performed by a user in my database as shown below. I want to get the mean or centre of these distances to use as the single location for each user.
Action location.lon location.lat
user1 -6.2346259 53.3371473
user1 0 0
user4 -6.22550044 53.59729241
user2 -6.262663209 53.33398243
user2 -6.289571616 53.32012803
user3 8.6388684 49.3024665
user5 -80.434882 39.2474397
user3 -2.460740516 52.60026199
user3 -122.5168562 -37.92878211
I have this information in R and mongodb, so I will be happy with suggestions in both.
Thank you in advance.