Skip to content

436 fr function format sigfig j - #437

Open
iaugusty wants to merge 8 commits into
devfrom
436-FR-function-format_sigfig_j
Open

436 fr function format sigfig j#437
iaugusty wants to merge 8 commits into
devfrom
436-FR-function-format_sigfig_j

Conversation

@iaugusty

Copy link
Copy Markdown
Collaborator

Pull Request

Fixes #436

Checks

  • (Have you updated the NEWS.md ?)
  • (Have you added proper tests for new functions/features ?)
  • (Have you added new functions to the pkgdown.yml ?)
  • (Have you run document() on new functions ?)

@wwojciech wwojciech left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the idea looks good to me. Nevertheless, it would be good to clarify and potentially improve some of the design assumptions and implementation details, as indicated in my comments.

Please also check whether the CI/CD failure is related to the new code.

Comment thread R/jjcsformats.R Outdated

#' @return numeric vector of the same length as `x`, rounded to `digits` significant figures.
#' @keywords internal
signif_j <- function(x, digits = 6, round_type = valid_round_type, whole_integer = FALSE, zero_threshold = 0) {

@wwojciech wwojciech Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd aim for the most straightforward extension of base::signif(): preserve its behavior while allowing custom rounding, including the support for round_fun that does not support negative digits; and an optional zero_threshold.

I propose:

signif_j <- function(
  x,
  digits = 6,
  zero_threshold = 0,
  round_fun = round_fmt,
  ...
)

Here, ... are passed as arguments to round_fun.

Comment thread R/jjcsformats.R
Comment thread R/jjcsformats.R Outdated
@munoztd0

Copy link
Copy Markdown
Collaborator

Overall, the idea looks good to me. Nevertheless, it would be good to clarify and potentially improve some of the design assumptions and implementation details, as indicated in my comments.

Please also check whether the CI/CD failure is related to the new code.

CI/CD issues are not related to us, just ubuntu stuff, will resolveshortly

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

Successfully merging this pull request may close these issues.

4 participants