Caribou Locations
Maps with ggplot2, Calculating distance and speed with geosphere
Notable topics: Maps with ggplot2, Calculating distance and speed with geosphere
Recorded on: 2020-06-22
Timestamps by: Eric Fletcher
Screencast
Timestamps
Use summarize and across to calculate the proportion of NA values in the individuals dataset. Note, you do not need to use list().
Use ggplot and borders from the ggplot2 package to create a map of Canada with deploy_on_longitude and deploy_on_latitude from the individuals dataset.
Import Canada province shapefile using the sf package. [Unsuccessful]
Use min and max from base r within summarize to find out the start and end dates for each caribou in the locations dataset.
Use sample from base r to pick one single caribou at a time then use the subset with geom_path from ggplot2 to track the path a that caribou takes over time. color = factor(floor_date(timestamp, "quarter") is used to color the path according to what quarter the observation occured in.
Use as.Date from base r and floor_date from the lubridate package to convert timestamp variable into quarters then facet_wrap the previous plot by quarter.
Within mutate, use as.numeric(difftime(timestamp, lag(timestamp), unit = "hours")) from base r to figure out the gap in time between observations.
Use distHaversine from the geosphere package to calculate distance in km then convert it to speed in kph.
Summary of dataset.