Skip to content

add a column or test with the rowwise sum in scan_data() #252

@avallecam

Description

@avallecam

Please place an "x" in all the boxes that apply

  • I have the most recent version of this package and R
  • I have found a bug
  • I have a reproducible example
  • I want to request a new feature

Please include a brief description of the problem with a code example:

Hi @Karim-Mane, while reviewing tutorials monthly update, I found this: Package version 1.1.1 generates proportion values with a total sum that is different from 1, compared to version 1.1.0. Reprex for both versions below:

Bug: pak::pak("cleanepi@1.1.1")

library(dplyr)

rio::import("https://epiverse-trace.github.io/tutorials-early/data/simulated_ebola_2.csv") %>%
  cleanepi::scan_data() %>% 
  dplyr::rowwise() %>% 
  dplyr::mutate(total = sum(dplyr::c_across(missing:logical)))
#> # A tibble: 6 × 7
#> # Rowwise: 
#>   Field_names missing numeric  date character logical total
#>   <chr>         <dbl>   <dbl> <dbl>     <dbl>   <dbl> <dbl>
#> 1 age          0.069    0.892 0        0.108        0  1.07
#> 2 gender       0.187    0.056 0        0.944        0  1.19
#> 3 status       0.0565   0     0        1            0  1.06
#> 4 date onset   0.0001   0     0.916    0.0841       0  1.00
#> 5 date sample  0.0001   0     1        0            0  1.00
#> 6 region       0        0     0        1            0  1

packageVersion("cleanepi")
#> [1] '1.1.1'

Created on 2025-08-07 with reprex v2.1.1

Correct: pak::pak("cleanepi@1.1.0")

# pak::pak("cleanepi@1.1.0")

library(dplyr)

rio::import("https://epiverse-trace.github.io/tutorials-early/data/simulated_ebola_2.csv") %>%
  cleanepi::scan_data() %>% 
  dplyr::rowwise() %>% 
  dplyr::mutate(total = sum(dplyr::c_across(missing:logical)))
#> # A tibble: 6 × 7
#> # Rowwise: 
#>   Field_names missing numeric  date character logical total
#>   <chr>         <dbl>   <dbl> <dbl>     <dbl>   <dbl> <dbl>
#> 1 age          0.0646  0.835  0         0.101       0     1
#> 2 gender       0.158   0.0472 0         0.795       0     1
#> 3 status       0.0535  0      0         0.946       0     1
#> 4 date onset   0.0001  0      0.916     0.084       0     1
#> 5 date sample  0.0001  0      1.00      0           0     1
#> 6 region       0       0      0         1           0     1

packageVersion("cleanepi")
#> [1] '1.1.0'

Created on 2025-08-07 with reprex v2.1.1


This was diagnosed while reviewing the monthly automatic update of tutorial episodes. Visualise whole comparison at https://github.com/epiverse-trace/tutorials-early/compare/md-outputs..md-outputs-PR-198

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions