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

Add columns fmt_fn, warning, and errors to ard_attributes output #343

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions R/ard_attributes.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ ard_attributes.data.frame <- function(data,
),
context = "attributes"
) |>
dplyr::mutate(
fmt_fn = list(as.character),
warning = list(NULL),
error = list(NULL)
) |>
ddsjoberg marked this conversation as resolved.
Show resolved Hide resolved
cards::tidy_ard_column_order() |>
as_card()
}
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/_snaps/ard_attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@
2 var1 attributes class Variable Class character
3 var2 attributes label Variable Label UPPERCASE LETTERS
4 var2 attributes class Variable Class character
fmt_fn warning error
1 .Primitive("as.character") NULL NULL
2 .Primitive("as.character") NULL NULL
3 .Primitive("as.character") NULL NULL
4 .Primitive("as.character") NULL NULL

7 changes: 7 additions & 0 deletions tests/testthat/test-ard_attributes.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ test_that("ard_attributes() errors when there is no dataframe", {
"There is no method for objects of class <character>."
)
})

test_that("ard_attributes() follows ard structure", {
expect_silent(
ard_attributes(ADSL[c("AGE", "AGEGR1")]) |>
check_ard_structure(method = FALSE)
)
})
Loading