1.Use the function hav_dist() to create the column my_distance.
2.Create the column diff which is the difference between my_distance and trip_distance.
3.Find the minimum and the maximum of the diff column
I have already created the additional columns my_distance and diff using mutate, but now how to calculate the minimum and the maximum of the diff column???
This is what I wrote down below, why does R keep telling me that "Error: cannot coerce type 'closure' to vector of type 'double'"
# Create my_distance and diff
taxis_my_dist <- taxis %>%
mutate(my_distance = hav_dist(pickup_longitude , pickup_latitude ,
dropoff_longitude, dropoff_latitude ),
diff = trip_distance-my_distance)
# Find the min and the max of diff
which.min(diff)
which.max(diff)