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

Change big.mark default in number() #162

Closed
dpseidel opened this issue Jul 24, 2018 · 3 comments
Closed

Change big.mark default in number() #162

dpseidel opened this issue Jul 24, 2018 · 3 comments

Comments

@dpseidel
Copy link
Collaborator

I noticed when working on the new bytes() function that the default big.mark for number() and percent() is a space, giving kind of an awkward default output:

library(scales)
number(c(1000, 2000, 4000))
#> [1] "1 000" "2 000" "4 000"
percent(c(2, 5, 20))
#> [1] "200%"   "500%"   "2 000%"

I'd like to change the default to big.mark = "" for a more traditional number style. An easy PR but I wanted to check that this was the right move: @larmarange was the space default intentional for some reason?

@larmarange
Copy link
Contributor

It was discussed in #142

There are some reasons to use a space as default thousands separator:

  • using comma as the thousands separator is the purpose of comma_format specific formatter;
  • in an international perspective, it would be more relevant to use a space as a thousands separator, as used for example by Lancet journal (a space for thousands separator and a dot for decimal separator being a good compromise for a good understanding for an international audience);
  • since 2003, the use of spaces as separators (for example: 20 000 and 1 000 000 for "twenty thousand" and "one million") has been officially endorsed by SI/ISO 31-0 standard, as well as by the International Bureau of Weights and Measures and the International Union of Pure and Applied Chemistry (IUPAC), the American Medical Association's widely followed AMA Manual of Style, and the Metrication Board, among others. (cf. https://www.wikiwand.com/en/Decimal_separator#/Digit_grouping)

We discussed alternative approaches with @hadley, by setting big.mark or decimal.mark with NULL as a default.

if (is.null(decimal.mark)) {
  decimal.mark = if (identical(big.mark, ",")) "." else ","
}

But this behaviour is probably not the best. If I need to present results in an international format, I have to specify big.mark = " " but I want to keep a dot as a decimal separator.

If I want to present results in French, the first thing I want to set is the decimal.mark as a comma, and the change of big.mark is a consequence of this previous change.

Therefore, there is no general rule to derive decimal.mark from big.mark.

It is true that using a space as the default thousands separator is more generic as it is working with different decimal marks.

In addition, for those in need to present results in an American style, there is still the comma_format that will be simply a short cut for number_format with a comma as the default decimal mark.

Finally, it was decided to keep the default big.mark equal to " ".

However, changing the default big.mark value for "" could also be a valid option. In such case, a big.mark would be used only if explicitely expressed by the user.

@hadley
Copy link
Member

hadley commented Jul 25, 2018

I don't have strong feelings about whether or not we should make the default " " or "". But either way, this will make for a good section of the release blog post.

@dpseidel
Copy link
Collaborator Author

Ah thanks @larmarange, the original discussion slipped my mind, I should have checked back through PRs. Seems reasonable to leave it as is and yes, definitely a good thing to highlight in the release blogpost. I'll close this now.

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

No branches or pull requests

3 participants