Bug 17183 - 'prettyDate' simplification
Summary: 'prettyDate' simplification
Status: UNCONFIRMED
Alias: None
Product: R
Classification: Unclassified
Component: Wishlist (show other bugs)
Version: R-devel (trunk)
Hardware: All All
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2016-11-20 13:36 UTC by Suharto Anggono
Modified: 2016-11-24 15:18 UTC (History)
0 users

See Also:


Attachments
seqDtime (613 bytes, patch)
2016-11-20 13:38 UTC, Suharto Anggono
Details | Diff
prettyDate: calcSteps (1.22 KB, patch)
2016-11-20 13:42 UTC, Suharto Anggono
Details | Diff
prettyDate: calcSteps, alternative, allowing NA (1.75 KB, patch)
2016-11-20 13:45 UTC, Suharto Anggono
Details | Diff
prettyDate, remove special cases (7.06 KB, patch)
2016-11-20 13:53 UTC, Suharto Anggono
Details | Diff
prettyDate: add new interval right or left for steps[[1]] (1.47 KB, patch)
2016-11-20 14:03 UTC, Suharto Anggono
Details | Diff
prettyDate: calcSteps (1.67 KB, patch)
2016-11-21 16:38 UTC, Suharto Anggono
Details | Diff
prettyDate, remove special cases (7.30 KB, patch)
2016-11-21 16:40 UTC, Suharto Anggono
Details | Diff
prettyDate: add new interval right or left for steps[[1]] (1.49 KB, patch)
2016-11-21 16:47 UTC, Suharto Anggono
Details | Diff
prettyDate: add new interval right or left for steps[[1]] (1.63 KB, patch)
2016-11-22 16:32 UTC, Suharto Anggono
Details | Diff
prettyDate: bump for steps[[1]], alternative (1.69 KB, patch)
2016-11-23 17:21 UTC, Suharto Anggono
Details | Diff
prettyDate: add new interval at steps[[1]], alternative (1.66 KB, patch)
2016-11-24 15:18 UTC, Suharto Anggono
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Suharto Anggono 2016-11-20 13:36:07 UTC
This attempts to make 'prettyDate' code simpler or shorter. I am going to put separate patches for different parts.
Comment 1 Suharto Anggono 2016-11-20 13:38:10 UTC
Created attachment 2184 [details]
seqDtime

Normally, 'mon' component of a "POSIXlt" object is 0-11.

Fixup is not necessary because 'as.POSIXct' handles out-of-range 'mon' component of a "POSIXlt" object.
Comment 2 Suharto Anggono 2016-11-20 13:42:02 UTC
Created attachment 2185 [details]
prettyDate: calcSteps
Comment 3 Suharto Anggono 2016-11-20 13:45:54 UTC
Created attachment 2186 [details]
prettyDate: calcSteps, alternative, allowing NA

This maintains "equally spaced" property. Removal of an NA tick results in a gap that is twice as long.
Comment 4 Suharto Anggono 2016-11-20 13:53:36 UTC
Created attachment 2187 [details]
prettyDate, remove special cases

This uses minimum step of "1 DSTday" if 'x' is a "Date" object.

This results in uniform behavior of covering as tight as possible within 'min.n' constraint, like 'pretty.default'.

This changes some output of current special cases.
Comment 5 Suharto Anggono 2016-11-20 14:03:08 UTC
Created attachment 2188 [details]
prettyDate: add new interval right or left for steps[[1]]
Comment 6 Suharto Anggono 2016-11-21 16:38:44 UTC
Created attachment 2189 [details]
prettyDate: calcSteps
Comment 7 Suharto Anggono 2016-11-21 16:40:58 UTC
Created attachment 2190 [details]
prettyDate, remove special cases
Comment 8 Suharto Anggono 2016-11-21 16:47:35 UTC
Created attachment 2191 [details]
prettyDate: add new interval right or left for steps[[1]]

I replace the patch of this part because 'seq.POSIXt' with by = "1 DSTday" may produce NA if the result is long enough.
Comment 9 Suharto Anggono 2016-11-22 16:32:20 UTC
Created attachment 2192 [details]
prettyDate: add new interval right or left for steps[[1]]
Comment 10 Suharto Anggono 2016-11-23 17:21:30 UTC
Created attachment 2193 [details]
prettyDate: bump for steps[[1]], alternative

If steps[[1]] is "1 DSTday", 'init.n' can be smaller than it should be because of removal of NA ticks. For that reason, this recalculates based on the original range.

This uses ideas of the code of the special cases.
Comment 11 Suharto Anggono 2016-11-24 15:18:19 UTC
Created attachment 2194 [details]
prettyDate: add new interval at steps[[1]], alternative

I change the patch because using 'floor' is unsafe. For example, if number of intervals from 'makeCluster' is actually 5, but its upper bound is calculated as 4.9999999999 and is regarded as 4, too many intervals are then added.