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

scan_data() gives incorrect results #151

Open
Bisaloo opened this issue Jul 17, 2024 · 0 comments
Open

scan_data() gives incorrect results #151

Bisaloo opened this issue Jul 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Bisaloo
Copy link
Member

Bisaloo commented Jul 17, 2024

In the current situation, the logical column will also always be 0.

Indeed, apply() will convert the data.frame to a matrix, i.e. a single type. This means in most cases, all columns will be converted as characters. In this situation, is.logical() will always give 0:

data <- readRDS(system.file("extdata", "messy_data.RDS",
                            package = "cleanepi"))
data$lgl <- TRUE

cleanepi::scan_data(
  data
)
#>    Field_names  missing  numeric     date character logical
#> 1      case_id 0.000133 0.999867 0.000000  0.000000       0
#> 2          age 0.064667 0.829733 0.000000  0.105600       0
#> 3       gender 0.161600 0.045733 0.000000  0.792667       0
#> 4       status 0.049733 0.000000 0.000000  0.950267       0
#> 5   date_onset 0.000133 0.793533 0.119600  0.086734       0
#> 6  date_sample 0.000133 0.793533 0.206067  0.000267       0
#> 7     district 0.000000 0.000000 0.000000  1.000000       0
#> 8     cheifdom 0.000000 0.000000 0.000000  1.000000       0
#> 9      age_cat 0.064667 0.000000 0.000000  0.935333       0
#> 10         lgl 0.000000 0.000000 0.000000  1.000000       0

Created on 2024-07-17 with reprex v2.1.1

@Bisaloo Bisaloo added the bug Something isn't working label Jul 17, 2024
@Karim-Mane Karim-Mane linked a pull request Jul 22, 2024 that will close this issue
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
None yet
Development

Successfully merging a pull request may close this issue.

1 participant