Now you're interested in seeing how much distance having to drive along roads (as opposed to in a straight line) adds to trips.

The function hav_dist() , which computes distance using the Haversine formula, has been defined for you. This function takes the longitude of the origin, the latitude of the origin, the longitude of the destination, and the latitude of the destination, in that order.

INSTRUCTIONS

Use the function hav_dist() to create the column my_distance .

Create the column diff which is the difference between my_distance and trip_distance .

Find the minimum and the maximum of the diff column.

Hi Martin
This is not a Home work Question. I am learning R myself through an online course and have nobody to ask questions. I came across this question and really got struck. Without answering this question I can't proceed further.
Appreciate if you can help or guide towards any site where I can solve this problem

If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.

This was the answer. Had a lot of issues with hav_dist calculating all rows to 0. Hit the button to show me the answer and it was exactly what I had typed out.