From the taxi data about June 2017:
library(data.table)
myDF <- fread("/anvil/projects/tdm/data/taxi/yellow/yellow_tripdata_2017-06.csv")
head(myDF)
The average cost for taxi rides, according to the number of passengers:
tapply(myDF$total_amount, myDF$passenger_count, mean)
The average cost for taxi rides, according to the VendorID:
tapply(myDF$total_amount, myDF$VendorID, mean)
The standard deviation of the trip distance, according to the number of passengers:
tapply(myDF$trip_distance, myDF$passenger_count, sd)