problem-1.7
problem-1.7
The
diff()
function returns the distance between fill-ups, so
mean(diff(gas))
is your average mileage per fill-up, and
mean(gas)
is the uninteresting average of the recorded mileage.