Closed stulacy closed 4 years ago
Wow, thank you so much! That is just fantastic.
I myself ran into this problem yesterday - I've documented this at #251, I think that it should be resolved by this, but there looks like there is one case that it doesn't quite solve.
Merged in, thank you again!
This function was previously returning NULL when the factor had no missing values. I've modified it to return the input if it has no missing values.
Description
The
gg_miss_fct
function wasn't working for a dataset I was using. I investigated and found the case being that the code attempts to reencode all NAs in thefct
argument using the in-built functioncoerce_fct_na_explicit
. However,coerce_fct_no_explicit
has no default return value, so if your factor fails the If check, the function returns NULL and thusgg_miss_fct
fails later on.I've resolved this by simply adding an Else statement to provide a default return value, being the input factor.
Example
Example below that fails using the current Master branch.
Running this example under my fork works:
Tests
I haven't run any automated testing. Let me know if this will be needed.
NEWS + DESCRIPTION
This is a bug fix so I don't believe the DESCRIPTION or NEWS.md need updating.