custom_dict can take two attributes: origin_regex and origin_valid. Both must be either NULL (in which case they are ignored) or character vectors. When origin is found in attr(custom_dict, "origin_regex"), the origin_regex is flipped TRUE automatically. When origin is not found in attr(custom_dict, "origin_valid"), we exit with an error.
countrycode_factory is a function factory that allows users to create new functions with different default arguments, or with a default dictionary.
Usage examples are given in the README of the functionfactory branch:
This is a first draft for two new features:
custom_dict
can take two attributes:origin_regex
andorigin_valid
. Both must be eitherNULL
(in which case they are ignored) or character vectors. Whenorigin
is found inattr(custom_dict, "origin_regex")
, theorigin_regex
is flippedTRUE
automatically. Whenorigin
is not found inattr(custom_dict, "origin_valid")
, we exit with an error.countrycode_factory
is a function factory that allows users to create new functions with different default arguments, or with a default dictionary.Usage examples are given in the README of the
functionfactory
branch:https://github.com/vincentarelbundock/countrycode/tree/functionfactory#custom-dictionary-attributes
This still needs documentation, etc., but I'd be very eager to get feedback on this, if anyone has time to take it for a spin. @cjyetman , maybe?