## distance between consecutive locations
mt_sim_brownian_motion() |>
mt_distance() |>
head()
## When the data has a coordinate reference system set,
## units are included
dist <- mt_sim_brownian_motion(1:4) |>
sf::st_set_crs(4326L) |>
mt_distance()
dist
## transform units of output
units::set_units(dist, km)
## speed between consecutive locations
mt_sim_brownian_motion() |> mt_speed()
## When projections are provided units are included
data <- mt_read(mt_example())[330:340, ]
speed_calc <- data |>
mt_speed()
speed_calc
## transform units of output
units::set_units(speed_calc, m / s)
## Different projection gives same speed
data |>
sf::st_transform("+proj=aeqd +units=km +lon_0=-73.9 +lat_0=42.7") |>
mt_speed() |>
units::set_units(m / s)
Run the code above in your browser using DataLab