mitchelloharawild / mixtime

Mixed time vectors for R
https://pkg.mitchelloharawild.com/mixtime/
GNU General Public License v3.0
4 stars 0 forks source link

Add conversion between granularities #1

Open mitchelloharawild opened 4 years ago

mitchelloharawild commented 4 years ago

Suppose you have a yearmonth and want to convert this into a yearquarter, or perhaps a date. A consistent approach for this could be to always convert to the first value within the desired granularity. So 1970 Jan would become 1970-01-01 (first day in 1970 Jan), or 1970 Q1 (only quarter containing Jan).

Some concepts could be drawn from 'precision' as used in vctrs casting, where precision reflects the granularity here.