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

convert_to_numeric() in a dataset of 500,000+ rows took 2.5 minutes #163

Open
avallecam opened this issue Jul 25, 2024 · 1 comment · May be fixed by epiverse-trace/numberize#14
Open

convert_to_numeric() in a dataset of 500,000+ rows took 2.5 minutes #163

avallecam opened this issue Jul 25, 2024 · 1 comment · May be fixed by epiverse-trace/numberize#14

Comments

@avallecam
Copy link
Member

avallecam commented Jul 25, 2024

running cleanepi::convert_to_numeric() in a dataset of 500,000+ rows took 2.5 minutes

wondering if this may be an expected scenario to happen and if this may require refactoring at an appropriate time to use data.table or dtplyr.

library(rio)
library(cleanepi)
library(tidyverse)
library(tictoc)

covid <- rio::import(
  "https://raw.githubusercontent.com/Joskerus/Enlaces-provisionales/main/data_limpieza.zip",
  which = "datos_covid_LA.RDS"
) %>% 
  cleanepi::standardize_column_names()

tictoc::tic()
covid %>% 
  dplyr::select(numero_de_hospitalizaciones_recientes) %>% 
  cleanepi::convert_to_numeric(
    target_columns = "numero_de_hospitalizaciones_recientes",
    lang = "es")
#> # A tibble: 502,010 × 1
#>    numero_de_hospitalizaciones_recientes
#>                                    <dbl>
#>  1                                     0
#>  2                                     0
#>  3                                     0
#>  4                                     0
#>  5                                     0
#>  6                                     0
#>  7                                     0
#>  8                                     0
#>  9                                    NA
#> 10                                     0
#> # ℹ 502,000 more rows
#> # ℹ Use `print(n = ...)` to see more rows
tictoc::toc()
#> 150.42 sec elapsed

cc: @Joskerus @lgbermeo

@Bisaloo Bisaloo linked a pull request Jul 28, 2024 that will close this issue
@Bisaloo
Copy link
Member

Bisaloo commented Jul 28, 2024

Could you give epiverse-trace/numberize#14 a go please? If the performance is still not sufficient, I have a couple of other ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants