I'm working on an
R package which does an automatic description of datasets (here if you ever want to check it out).
For now, the default behavior of the package is to describe any numeric variable with basic statistics, i.e minimum, maximum, median, IQR, mean, and standard deviation.
I would like to extend this behavior to dates as well. All those calculations can be performed for dates with no problem of interpretation, except for the standard deviation.
Here is an example:
my_date = structure(17897:17921, class = "Date") #in R, this creates a vector of all dates from 2019-01-01 to 2019-01-25 cross_summary(my_date) #a function from my package, rarely used on its own but OK for the example #> Min / Max #> "2019-01-01 / 2019-01-25" #> Med [IQR] #> "2019-01-13 [2019-01-07;2019-01-19]" #> Mean (std) #> "2019-01-13 (7.4)" #> N (NA) #> "25 (0)"
Here, the standard deviation is expressed in days which can be surprising, or at least hard to interpret. Moreover,
R has other date formats such as
POSIXct, for which the standard deviation would be expressed in seconds. I'm planning to add the unit after the standard deviation but I'm afraid this will not be enough.
However, I still find it important to have a measure of dispersion, in addition of IQR, as this latter has to round somehow in case of ties.
Is there a better measure of the dispersion of dates other than std and IQR? If not, how can I help my user interpret these beyond displaying the unit?