Fix issue tools::toTitleCase() does not accept factos as input#92
Conversation
…toTitleCase() to function propercase.
|
Thank you for your update. I believe the functionality of It may be better to keep |
… RACE if factor or character vectror. If factor, convert to character vector as input of tools::toTitleCase().
|
@fukuhiro2023, Thank you! I revert to use tools::toTitleCase(). I have added check for SEX if input is factor or not. If factor, will convert to character vector before putting into tools::toTitleCase(). For other inputs (i.e RACE, EPOCH), type of these inputs has converted to be character vector when applying tolower::() as tested, and thus I did not add check for these inputs but only SEX. Let me know your thoughts. |
|
I would suggest to write a helper function for pre-processing of the input data. The current implementation will break the order defined in factor that will introduce unexpected behavior from user perspective. Specifically:
|
- Enhanced propercase() and titlecase() to handle factors - Replaced direct toTitleCase calls with titlecase() wrapper - Added unit tests for both functions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
I just updated unit test are added. Feel this is sufficient for this PR to close #92. However, we should consider if we really need https://merck.github.io/metalite.ae/reference/prepare_ae_listing.html |
Replace tools::toTitleCase() to function propercase.