Calculate basic summary statistics per tracked individual. This function is useful for quickly understanding data coverage, gaps, and movement distance for each animal.
Arguments
- data
A data frame or sf object with columns `id`, `timestamp`, `x`, and `y`.
- start_date
Optional. A `Date` object or string (e.g., "2021-01-01"). Filters out data before this date.
- end_date
Optional. A `Date` object or string (e.g., "2021-01-15"). Filters out data after this date.
- report
Logical. If TRUE, opens an HTML summary table in your browser for easy copying into slides or documents.
Details
The following summary statistics are returned for each unique `id`:
`n_fixes`: Number of location records
`first_location`: Timestamp of the first recorded location
`last_location`: Timestamp of the last recorded location
`tracking_duration_days`: Duration between first and last fix (in days)
`fixes_per_day`: Average number of fixes per day
`median_interval_hours`: Median interval between fixes (in hours)
`max_time_gap_days`: Longest time gap between consecutive fixes (in days)
`distance_km`: Total distance traveled (in kilometers), calculated using the Haversine formula
`avg_speed_kmh`: Average speed (km/h), computed as distance divided by tracking duration in hours
Examples
data(godwit_tracks)
clean <- ez_track(godwit_tracks)
#> Detected columns - id: individual.local.identifier, timestamp: timestamp, x: location.long, y: location.lat
#> Removed 852 row(s) with missing or duplicate values.
ez_summary(clean)
#> id n_fixes first_location last_location
#> 1 animal1 1095 2024-12-31 16:00:00 2025-04-25 14:00:00
#> 2 animal2 1153 2024-12-31 16:00:00 2025-04-27 22:00:00
#> 3 animal3 1022 2024-12-31 16:00:00 2025-04-23 16:00:00
#> 4 animal4 214 2024-12-31 16:00:00 2025-04-27 16:00:00
#> 5 animal5 223 2024-12-31 16:00:00 2025-04-27 16:00:00
#> 6 animal6 551 2024-12-31 16:00:00 2025-04-27 16:00:00
#> tracking_duration_days fixes_per_day median_interval_hours max_time_gap_days
#> 1 114.92 9.53 2 0.33
#> 2 117.25 9.83 2 1.00
#> 3 113.00 9.04 2 1.00
#> 4 117.00 1.83 6 10.00
#> 5 117.00 1.91 6 13.38
#> 6 117.00 4.71 4 1.00
#> distance_km avg_speed_kmh
#> 1 5649.19 2.05
#> 2 5495.39 1.95
#> 3 6370.80 2.35
#> 4 2414.07 0.86
#> 5 2372.16 0.84
#> 6 5438.92 1.94