There are some limitations to using Date/Time variables in Displayr. For example, you cannot create filters for each time period with a single action. However, these can be achieved by creating an ordinal (or nominal) variable from the date variable.
Until 2026, creating an ordinal (or nominal) variable was also required to specify column comparisons using date variables, or to have irregular dates (e.g., one column representing a year, a second column representing a quarter). We made this process easier, allowing users to upgrade Date/Time variables and Customize the labels and categories of your Date/Time variable.
Requirements
- Familiarity with the Structure and Value Attributes of Variable Sets.
Method - Create categories based on the date aggregation
- Select the date/time variable from Data Sources.
- Press Date/Time Aggregation in Properties
> Attributes and modify the settings. For example, if you want to create months and quarters, you would set Aggregation to 1 Month.
- Press OK.
- Select any variable in the Data Sources tree, and click + > Custom Code > R > Nominal.
- In the Code
panel, paste in the following code and change
date_varto the name of your Date/Time variable :attr(date_var,"QDate") - You can use the + > Filter > Filters from Selected Data automation to create a filter for each time period category.
Method - Create categories for each underlying date in the data
If you have only a few different dates, the simplest approach is to click on the date/time variable and change its Structure to Ordinal. This will create a new category for every unique date/time value. Often, this leads to too many categories to be useful, so Method 2 is preferred.
UPCOMING WEBINAR: Run Research Your Way With AI Skills