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 3 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
2 changes: 1 addition & 1 deletion DESCRIPTION
Expand Up @@ -58,7 +58,7 @@ SystemRequirements: Rendering the document template requires
such as TinyTeX (>= 0.12; https://yihui.org/tinytex/)
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.2.2
RoxygenNote: 7.2.3
VignetteBuilder: knitr, R.rsp
Language: en-US
Roxygen: list(markdown = TRUE)
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
2 changes: 1 addition & 1 deletion inst/NEWS.md
@@ -1,6 +1,6 @@
# 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
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"
)
}
)