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

update description of colReorder's order parameter #1094

Open
ismirsehregal opened this issue Nov 8, 2023 · 5 comments
Open

update description of colReorder's order parameter #1094

ismirsehregal opened this issue Nov 8, 2023 · 5 comments

Comments

@ismirsehregal
Copy link

I just visited ?dataTableProxy

And I think the description of colReorder()'s order parameter needs an update - it is unclear to me:

A numeric vector of column positions, starting from 0, and including the row.names as a column, if they are include. Must contain a value for all columns, regardless of whether they are visible or not. Also for column reordering to work, the datatable must have extension 'ColReorder' set as well as option 'colReordoer' set to TRUE).

@yihui
Copy link
Member

yihui commented Nov 8, 2023

This function was originally contributed by @gergness via the PR #527. It might be clearer if you read the documentation of DataTables: https://datatables.net/reference/api/colReorder.order()

Anyway, @gergness do you have time to contribute one more time to clarify the doc here? Thanks!

@gergness
Copy link
Contributor

gergness commented Nov 8, 2023

Ha, never fun to re-read what I wrote a long time ago.

I'm having trouble improving the docs, I think the underlying functionality is confusing because the code is having to jump between javascript and R, so here's my first stab at it, but I wonder if @ismirsehregal has any suggestions:

A vector of column positions to reorder the columns in. This vector is passed directly to data.table javascript instance, so the indexing may behave differently than expected: it starts at 0, includes the row.names if they are displayed in the table, and also must include all column even those that have been hidden with hideCols() or showCols(). This functionality requires the datatable has extension 'ColReorder' turned on (see https://rstudio.github.io/DT/extensions.html).

@ismirsehregal
Copy link
Author

ismirsehregal commented Nov 8, 2023

Thanks @gergness this is much better (I'm not a native speaker, so maybe my lack of understanding is partly my own fault).

What about:

A vector of column positions to reorder the columns in. This vector is passed directly to the datatable javascript instance, so the indexing starts at 0. Furthermore, it includes the column position of the row.names if they are displayed in the table. The vector also must include all hidden columns (see hideCols() or showCols()).
This functionality requires the datatable has extension 'ColReorder' turned on (see https://rstudio.github.io/DT/extensions.html).

@gergness
Copy link
Contributor

gergness commented Nov 8, 2023

Oh gosh, no, I don't think it made a ton of sense to native speakers either.

That seems good to me! Happy to make the PR or you can if you want @ismirsehregal

@ismirsehregal
Copy link
Author

ismirsehregal commented Nov 8, 2023

Would be great if you make the PR (I'm currently only on mobile). Thank you!

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

No branches or pull requests

3 participants