How to measure a route on RStudio? with geojson package,or any other package.

I have a route that it has to be measured.
Help.
with geojson package,or any other package.

A good approach to measuring routes is via package gmapsdistance - it wraps around Google Distnace Matrix API, which implies agreement with Google T&C and some features of API require registration.

Unfortunately this does not work for me, due to I have an sp in a city, I've trying "geo_lenght", however I do not how to use it, properly.