Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot currently update a variable's class to "ordinal" #96

Open
nhward opened this issue Mar 6, 2024 · 2 comments
Open

Cannot currently update a variable's class to "ordinal" #96

nhward opened this issue Mar 6, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@nhward
Copy link

nhward commented Mar 6, 2024

The ability to change a variable to an ordinal factor is sorely missing in the current implementation of update tab of the datamods::import_server() module. This is not optional in the case of ordinal regression (i.e. ordinal target) or in the case of dummy encoding of ordinal predictors. Ordinal factors need to have a human-curated sequence of levels defined.

This would involve a sub-dialogue to determine the order of the factor levels. I think a selectize control (with multiple = true) would suffice in the short term but better dialogues can be imagined.

Ideally this would be a modal dialogue BUT this is problematic if the update process is already in a modal dialogue as would be the case with datamods::import_modal(). Some clever reuse of the existing modal dialogue would be required to emulate modal-within-modal. Alternatively the update-table could have an extra column for defining the ordinal sequence.

Either way this would be a welcome addition to the package.

@pvictor pvictor added the enhancement New feature or request label Mar 19, 2024
@pvictor
Copy link
Member

pvictor commented Apr 3, 2024

Hello,
We are going to add a separate module to order levels of a factor variable.
In module update-variable we can order as a choice and apply as.ordered() on the factor as is and then reorder levels afterwards with the new module.

@nhward
Copy link
Author

nhward commented Apr 4, 2024

Great news that you want to make this enhancement. I think it would be a good idea to correct the order of factor levels at the same time as migrating the character (or factor) variable to an ordinal factor. Otherwise, you risk only doing part of the job. Perhaps your plan is: only to factor is available in the existing dialogue and the ability to transform factors to ordinal factors happens in a separate dialogue that includes the ordering of levels.
I would be grateful for any implementation.

Aside:
Converting row-names into a variable is something that could (even should) be undertaken in your module. This is particularly relevant when using package datasets that employ row-names as observation identifiers. While not critical, this is an easy enhancement to implement.

Keep up the good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants