Due to this purrr issue (which may be fixed in the next release), using purrr::pmap with cdec_query can cause unexpected results when Date classes are passed to the start_date and/or end_date arguments to cdec_query. purrr:pmap strips the Date class prior to calling the function, which means cdec_query gets integer values for start_date/end_date rather than Date classes. For some reason this doesn't cause an error, it just ignores the start/end specs.
It would be great if cdec_query could have an error catch that makes sure the start_date or end_date arguments are either character or date classes. The simplest solution would probably be to make this change to query_url:
Due to this purrr issue (which may be fixed in the next release), using
purrr::pmap
withcdec_query
can cause unexpected results whenDate
classes are passed to thestart_date
and/orend_date
arguments tocdec_query
.purrr:pmap
strips theDate
class prior to calling the function, which meanscdec_query
gets integer values forstart_date
/end_date
rather thanDate
classes. For some reason this doesn't cause an error, it just ignores the start/end specs.It would be great if
cdec_query
could have an error catch that makes sure thestart_date
orend_date
arguments are either character or date classes. The simplest solution would probably be to make this change toquery_url
:Which would cause
cdec_query
to error out when trying to convert an integer to a date without an origin.