There is a data frame already given called taxis, now I have to do the following,but I am stuck on the last step...
# 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
max(taxis[,diff])
min(diff)
taxis_my_dist <- taxis %>%
mutate(my_distance = hav_dist(pickup_longitude , pickup_latitude ,dropoff_longitude, dropoff_latitude ),
diff = trip_distance-my_distance)
max(taxis_my_dist$diff)
min(taxis_my_dist$diff)
Almost there!
library(dplyr)
taxis %>%
mutate(my_distance = hav_dist(pickup_longitude , pickup_latitude ,dropoff_longitude, dropoff_latitude ),
diff = trip_distance-my_distance) %>%
summarise(
max = max(diff)
min = min(diff)
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.