Closed nikhailarum closed 5 months ago
Hi, no need to share data. You will have to iterate over animals and resample them individually. I usually use nest
for that:
Elephants_1Hour <- track_resample(data, rate = minutes(60))
trk1 <- nest(Elephants_1HHour, dat = -id)
trk1 <- mutate(trk1, dat = map(dat, ~ track_resample(.x, rate = minutes(60)))) |> unnest(cols = dat)
This should give you the expected results.
Hello
I recently wanted to resample some GPS collar relocations to remove erroneous fixes as well as fixes that were reset to 15 mins. I want only hourly fixes in the dataset I am to analyse. I managed to resample my data but realised the function did not take into account the different individual animals present in the dataset.
My work process looks as follows:
setwd ("C:/Users/niggu/Documents/Northern_Kenya_Drinking/Samburu_Data_to_Buffer") elephants <- read.csv("Samburu_1999_2008.csv")
Converts Timestamp to POSIXct
elephants$timestamp <- as.POSIXct(elephants$timestamp)
Make track from datatable
data <- make_track(elephants, .x = location.long, .y = location.lat, .t = timestamp, id = name)
Resample to 1 hour
Elephants_1Hour <- track_resample(data, rate = minutes(60))
This then returns a reduced dataset that appears to be resampled (from 700 000 data points to 80 000) however, many individual animals are missing days worth of data as they were removed due to being within an hour of the timestamp for a different animal.
Would really appreciate any assistance with what might be a trivial solution. Sadly, I cannot share any data publicly, so I won't be able to give you a sample if you need this
Regards Nikhail