mock_date() is the simple direct API for date variables. It returns a
validated mock_spec; it does not generate data.
Arguments
- name
Variable name.
- range
Date vector of length two giving the inclusive valid date range.
- rtype
R output type. Defaults to
"date".- source_format
Source-format hint. Defaults to
"analysis".- missing_codes
Explicit missing-code values.
- missing_proportions
Missing-code probabilities aligned to
missing_codes.- garbage_rules
List of intentional invalid-value rules.
- provenance
Optional provenance metadata. Defaults to the direct API.
- model_hint
Backend hint.
- spec_version
Character version of the specification shape.
Details
Date variables default to model_hint = "native-postprocess" because MockData
owns calendar-date generation and source-format conversion. Optional
backends may still generate other variables in the same specification.
See also
Other direct specification APIs:
mock_categorical(),
mock_continuous()
Examples
interview_date_spec <- mock_date(
"interview_date",
range = as.Date(c("2001-01-01", "2005-12-31"))
)
validate_mock_spec(interview_date_spec)
#> MockData mock_spec validation result: valid