Closed agustinggza closed 3 years ago
At first, thank you for your work; huxtable is very usefull.
Well, I'd like formating a number with % and decimal.mark=",".
I tried this:
Can you solve this one?
You need to set options(OutDec=",")
.
Which then reveals a real bug:
options(OutDec=",")
hux(1.51) %>% set_number_format("%2.3f %%")
## 1.000 %,51.000 %
##
## Column names: 1.51
hux(1.51) %>% set_number_format(fmt_percent(digits=2))
## 100,00%,5100,00%
##
## Column names: 1.51
Working with OutDec
turned on is pretty screwed up. In huxtable and possibly in R in general.
My best workaround for you is:
fmt_pct_comma <- list(function (x) paste0(prettyNum(x, decimal.mark=","), "%"))
hux(1.51) %>% set_number_format(fmt_pct_comma)
## 1,51%
##
## Column names: 1.51
Ok, using github master could you try
hux(1.51) %>% set_number_format(fmt_percent(decimal.mark = ","))
That should do what you want. See documentation for fmt_percent()
Before using this form, please read
?"huxtable-FAQ"
. In particular:PLEASE DON'T USE GITHUB ISSUES FOR HELP REQUESTS.
Github issues are for bug reports and feature requests only. If you have a help request, post it to e.g. stackoverflow or community.rstudio.com, and drop me an email with the link. I will try to help out, and this will benefit other users. Help requests found here will be closed with a short response, which is not guaranteed to be polite.
OK? On with the show.
Describe what is missing What problem does this feature solve? Or, what would this feature enable the user to do that they can't do currently? Or, how would this feature make using huxtable easier?
Describe your proposed solution A clear and concise description of what you want to happen. Give code examples if that helps.
Target audience What set of people would this feature benefit?
Additional context Add any other context about the feature request here.