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

Remove arsenal dependency and fix empty row index bug #173

Merged
merged 2 commits into from
Sep 2, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ BugReports: https://github.com/epiverse-trace/cleanepi/issues
Depends:
R (>= 4.0.0)
Imports:
arsenal,
checkmate,
dplyr,
janitor,
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# cleanepi 1.0.2.9000

## Bug fixes

* Fixed a bug in the index for empty rows returned by `print_report()` after `remove_constants()`. It was always returning the number of rows in the original data frame, instead of the index of empty rows (#173, @Bisaloo).

## New minor features

* Added a `NEWS.md` file to track changes to the package.
5 changes: 1 addition & 4 deletions R/remove_constants.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ remove_constants <- function(data, cutoff = 1L) {

# report empty rows if found
if (nrow(data) > nrow(dat)) {
add_this <- summary(
arsenal::comparedf(data, dat)
)[["obs.table"]][["observation"]]
report[["empty_rows"]] <- add_this
report[["empty_rows"]] <- which(rowSums(is.na(data)) == ncol(data))
}

# remove constant columns
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-remove_constants.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ test_that("remove_constants works", {
expect_identical(report[["empty_columns"]], "empty_column")
expect_identical(report[["constant_columns"]],
"event_name, country_code, country_name")
expect_identical(report[["empty_rows"]], 10L)
expect_identical(report[["empty_rows"]], 7L)
Karim-Mane marked this conversation as resolved.
Show resolved Hide resolved
})
1 change: 0 additions & 1 deletion vignettes/design_principle.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ The modules and surrogate functions will depend mainly on the following packages
[{matchmaker}](https://CRAN.R-project.org/package=matchmaker) utilized to perform the dictionary-based cleaning,
[{lubridate}](https://CRAN.R-project.org/package=dplyr) used to create, handle, and manipulate objects of type Date,
[{reactable}](https://CRAN.R-project.org/package=reactable) mainly used here to customize the data cleaning report,
[{arsenal}](https://CRAN.R-project.org/package=arsenal) used in standardizing column names,
[{snakecase}](https://CRAN.R-project.org/package=snakecase) used in standardizing column names to transform everything into snake-case except when specified otherwise,
[{withr}](https://CRAN.R-project.org/package=withr) utilized to handle the creation of temporary files and directory relevant for `print_report()` and,
[{readr}](https://CRAN.R-project.org/package=readr) used to import data.
Expand Down
Loading