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

update print_report() function: account for when scan_data() is not e… #193

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

Karim-Mane
Copy link
Member

Changes in this PR aims at addressing issue #192

scan_data() returns NA when there is no character column found from the input data. I have set scanning_result = NA in the print_report() function. This will prevent from the error detected by @avallecam when print_report() is given a dataset where scan_data() was not applied to.

@Karim-Mane Karim-Mane added the bug Something isn't working label Oct 25, 2024
@Karim-Mane Karim-Mane self-assigned this Oct 25, 2024
Copy link
Member

@avallecam avallecam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes fixed the issue. thanks!

data <- readRDS(system.file("extdata", "test_df.RDS", package = "cleanepi"))

# introduce an empty column
data$empty_column <- NA
# introduce some missing values across some columns
data$study_id[3] = NA_character_
data$date.of.admission[3] = NA_character_
data$date.of.admission[4] = NA_character_
data$dateOfBirth[3] = NA_character_
data$dateOfBirth[4] = NA_character_
data$dateOfBirth[5] = NA_character_

# with cutoff = 1, line 3, 4, and 5 are not removed
test <- cleanepi::remove_constants(
  data = data,
  cutoff = 1
)

out <- cleanepi::remove_constants(
  data = test,
  cutoff = 0.5
)

cleanepi::print_report(out)
#> Generating html report in C:\Users\ANDREE~1\AppData\Local\Temp\Rtmpe662Cz
#> [1] "C:\\Users\\ANDREE~1\\AppData\\Local\\Temp\\Rtmpe662Cz/cleanepi_report__2024-10-25_at_142051.html"

Created on 2024-10-25 with reprex v2.1.1

@Karim-Mane Karim-Mane linked an issue Oct 25, 2024 that may be closed by this pull request
4 tasks
@Karim-Mane Karim-Mane merged commit 4f4b9f6 into main Oct 25, 2024
8 checks passed
@Karim-Mane Karim-Mane deleted the fix-issue-192 branch October 25, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

error with print_report()
2 participants