francisbarton / myrmidon

A package containing functions I want to have available most times I start up R, as well as my own HTML5 RMarkdown template.
MIT License
4 stars 0 forks source link

Remove `fix_invalid` step from postcode_data_join and instead use a separate helper function #8

Open francisbarton opened 6 months ago

francisbarton commented 6 months ago

The behaviour of the fix_invalid subroutine in postcode_data_join() is a bit too haphazard to be run automatically in the middle of a user-facing function. It also makes the whole function harder to debug and read as a piece of code.

We should create a helper function that suggests replacements for invalid postcodes, and allow the user to replace these in their source data or as a step in their lookup process as they wish.

This makes it clear that any replacements are just suggestions, and it is up to the user to decide whether they are suitable.

It will also show more clearly to the user how many postcodes are invlaid, and which could be "fixed" and which could not.

francisbarton commented 6 months ago

Just need to put some tests in place