A user wants to keep track of his mileage each time he fills up. The last 6 fills were 65311, 65624 ,65908 ,66219 ,66499, 66821 ,67145, 67447.He wants to find the number of miles between fill ups using R.How to do that?

958    Asked by ABHISubramaniam in Data Science , Asked on Nov 19, 2019
Answered by ABHI Subramaniam

To put all the fill ups, let assign it to a variable miles

miles=c(65311,65624,65908,66219,66499,66821,67145,67447)

x=diff(miles)

X

[1] 313 284 311 280 322 324 302

The above outputs are the miles between every fill up.



Your Answer

Interviews

Parent Categories