-
Notifications
You must be signed in to change notification settings - Fork 181
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
Scientific notation format function for DT #938
Comments
The simplest way of doing this is to convert the numeric column into a character column |
Hi, this could work, but I would like to be able to order (in descending/ascending order) the values in the columns where the scientific notation is used. If the values are characters I'm not sure the ordering would work. Thank you, anyway. |
@lrosaleny After PR #949 being merged, you can do it by using the new tbl = cbind(cars, cars)
colnames(tbl) = c("speed", "dist", "speed_raw", "dist_raw")
DT::datatable(tbl, formatter = list(
speed = function(x) format(x, scientific = TRUE),
dist = function(x) format(x, scientific = TRUE)
)) |
Hi, I get an
Was formatter argument officially included in the package? I don't see any reference to it in help documentation. Session info:
|
Thanks... I saw that post and all answers before to reach this issue. None of the answers explains what happened with formatter. |
@egoipse the formatter argument has not been merged into DT, yet. I can't find any time in the coming months to finish this. Please use alternative solutions. Thanks! |
Hi,
I'm trying to format some columns with scientific notation and finding it very difficult. I have been trying to write a short javascript snippet to take advantage of toExponential using rowCallback, but to no avail (see example in https://stackoverflow.com/questions/49634329/how-to-force-scientific-notation-with-renderdt).
I was wondering if a formatScientific function could be created, as the ones that DT already has (formatCurrency, formatRound, etc ...)
This formatScientific could use as argument the number of decimal digits to use for the significand (or mantissa) in order to get a number with normalized scientific notation (https://en.wikipedia.org/wiki/Scientific_notation)
Thank you very much to all the contributors in this repo. Your work is highly appreciated!
By filing an issue to this repo, I promise that
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')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: