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

DT::formatRound raises an error if argument columns has names #831

Closed
3 tasks done
jarauh opened this issue Jul 27, 2020 · 2 comments
Closed
3 tasks done

DT::formatRound raises an error if argument columns has names #831

jarauh opened this issue Jul 27, 2020 · 2 comments
Labels
Milestone

Comments

@jarauh
Copy link
Contributor

jarauh commented Jul 27, 2020

I hit the following error with more recent R versions (which tend to preserve more names) and DT-0.14:

data <- mtcars
dbl_cols <- which(
  vapply(colnames(data),
         function(x) is.double(data[[x]]) &&
           ! inherits(data[[x]], "integer64"),
         TRUE))
dt <- DT::datatable(data)
DT::formatRound(dt, dbl_cols, mark = ".", dec.mark = ",")   # this does not work
DT::formatRound(dt, unname(dbl_cols), mark = ".", dec.mark = ",") # this works

The first DT::formatRound raises the rather obscure error "'options' must be a fully named list, or have no names (NULL)". The second command works.

This probably also concerns similar functions from DT.

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.name/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('DT'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/DT').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@shrektan shrektan added the bug label Jul 27, 2020
@shrektan shrektan added this to the v0.15 milestone Jul 27, 2020
@shrektan
Copy link
Collaborator

Thanks for the report and it should have been fixed.

@jarauh
Copy link
Contributor Author

jarauh commented Jul 28, 2020

Wow, that was quick! Thanks.

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

No branches or pull requests

2 participants