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

Solves issue #559 #565

Merged
merged 8 commits into from Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"
)
}
)