How to calculate average number of days between series of dates?
I have a dataset with a series of dates listed for each variable. I want to calculate the average number of days for each variable. Ideally, I would get a numeric value that would have the average.
For example, VarA would be 1 because there is an average of one day between each value. Each variable has the dates in order (ex. VarA has the most recent date last).
How would I do this in R?
Example of my dataset:
Variable | Date1 | Date2 | Date3 | Date 4 |
---|---|---|---|---|
VarA | 09/01/21 | 09/02/21 | 09/03/21 | 09/04/21 |
VarB | 08/01/21 | 08/17/21 | 09/02/21 | |
VarC | 09/25/21 |
from Recent Questions - Stack Overflow https://ift.tt/39HR78o
https://ift.tt/eA8V8J
Comments
Post a Comment