Skip to content

Commit

Permalink
Merge pull request #565 from crsh/issue559
Browse files Browse the repository at this point in the history
Solves issue #559
  • Loading branch information
mariusbarth committed Sep 27, 2023
2 parents 23d7a31 + b44ae90 commit 5e99272
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
5 changes: 3 additions & 2 deletions R/apa_num.R
Expand Up @@ -430,12 +430,13 @@ print_p <- apa_p
#' should be determined for each element of `x` separately (the default),
#' or for the complete vector `x`.
#' @inherit apa_num return
#' @inheritParams base::formatC
#' @seealso [apa_num()], [apa_p()]
#' @examples
#' apa_df(c(1, 1.23151))
#' @export

apa_df <- function(x, digits = 2L, elementwise = TRUE) {
apa_df <- function(x, digits = 2L, big.mark = "", elementwise = TRUE) {

if(is.null(x)) return(NULL)
if(is.integer(x)) return(apa_num(x))
Expand All @@ -455,7 +456,7 @@ apa_df <- function(x, digits = 2L, elementwise = TRUE) {
digits <- 0L
}

apa_num(x, digits = digits)
apa_num(x, digits = digits, big.mark = big.mark)
}

#' @rdname apa_df
Expand Down
7 changes: 6 additions & 1 deletion inst/NEWS.md
@@ -1,6 +1,11 @@
# Upcoming release

- Degrees of freedom are now (as a new default) reported without a comma as a big mark, resolves #559 reported by @Fritz-theCat.


# papaja 0.1.1

- Maintenance update: Adjuted unit tests to avoid removal from CRAN
- Maintenance update: Adjusted unit tests to avoid removal from CRAN

# papaja 0.1.0

Expand Down
8 changes: 6 additions & 2 deletions man/apa_df.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions tests/testthat/test_apa_num.R
Expand Up @@ -268,3 +268,19 @@ test_that(
)
}
)

test_that(
"apa_df() respects big.mark"
, {
# default
expect_identical(
apa_df(1e4)
, "10000"
)
# with other argument
expect_identical(
apa_df(1e4, big.mark = "{,}")
, "10{,}000"
)
}
)

0 comments on commit 5e99272

Please sign in to comment.