Skip to content

request additional format for list_valid_format_labels() #349

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

Open
wtagr opened this issue May 8, 2025 · 4 comments
Open

request additional format for list_valid_format_labels() #349

wtagr opened this issue May 8, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@wtagr
Copy link

wtagr commented May 8, 2025

As a study statistician, I want to add the format of "xx.x : xx.x" or customized format in list_valid_format_labels(), so that i could create the designated format. Thanks.

@wtagr wtagr added the enhancement New feature or request label May 8, 2025
@wtagr wtagr closed this as completed May 8, 2025
@wtagr
Copy link
Author

wtagr commented May 8, 2025

I thought it was old issue, but not: i am thinking the customed format could be shown in the shell style.

@wtagr wtagr reopened this May 8, 2025
@edelarua
Copy link
Contributor

edelarua commented May 8, 2025

Hi @wtagr,

For a quick solution, you can make your own custom formatting functions to use in your work as follows:

library(formatters)
fmtfun <- sprintf_format("%.1f : %.1f")
format_value(list(1.015, 52.742), format = fmtfun)
#> [1] "1.0 : 52.7"

Created on 2025-05-08 with reprex v2.1.1

@wtagr
Copy link
Author

wtagr commented May 8, 2025

Hi @wtagr,

For a quick solution, you can make your own custom formatting functions to use in your work as follows:

library(formatters)
fmtfun <- sprintf_format("%.1f : %.1f")
format_value(list(1.015, 52.742), format = fmtfun)
#> [1] "1.0 : 52.7"
Created on 2025-05-08 with reprex v2.1.1

Thanks! yes, this works for the real data; however, I am using table_shell() for shell. For the customized format, it shows , rather xx.x : xx.x.

@edelarua
Copy link
Contributor

edelarua commented May 8, 2025

Ah I see! You are correct then; it's not currently possible to display formats in the table shell unless they are from the list of valid formats in {formatters}.

This was discussed recently here: insightsengineering/rtables#1022

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