njtierney / naniar

Tidy data structures, summaries, and visualisations for missing data
http://naniar.njtierney.com/
Other
652 stars 53 forks source link

Imputation of categorical data #336

Open sebastian-gerdes opened 1 year ago

sebastian-gerdes commented 1 year ago

Hi there!

Thanks for the package. Am I missing something (I did search the help files) or does naniar not have functions for imputing categorical data?

If no methods for categorical data are available:

Thanks for your time and best greetings, Sebastian

njtierney commented 1 year ago

Hi there!

There is a very simple approach with fixed values, using impute_factor: https://naniar.njtierney.com/reference/impute_factor.html

However this is relatively simple, were you thinking of something more sophisticated?

Note that you can use impute_mode with an object that is a factor

https://naniar.njtierney.com/reference/impute_mode.html

Let me know what you think, I'd be happy to include more methods if you would like to submit a pull request :)

Cheers,

Nick

sebastian-gerdes commented 1 year ago

Dear Nick,

thanks for your kind answer! 'impute_factor' is currently only in the development version of narnia, right?

I like the simplicity of impute_factor and impute_mode. However, in some situations it would be indeed nice to have more sophisticated methods in my opinion. So far I have neither contributed code to an open source project nor have I a good background on imputation methods, but I could try to change both ;-). I have put it on my to-do-list and I hope to be able to contribute in the not so distant future :-)

Cheers and best greetings, Sebastian