Skip to content

Commit

Permalink
fixed #12
Browse files Browse the repository at this point in the history
  • Loading branch information
RodrigoZepeda committed Dec 23, 2022
1 parent 6384ffc commit dbec219
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
^create_sticker.R
^\.github$
^scratch$
^paper_spm$
^_snaps$
^data-raw$
^codecov\.yml$
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ covidmx.csv
create_sticker.R
scratch*
!datos_abiertos_covid19.zip
paper_spm/

2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ License: MIT + file LICENSE
Encoding: UTF-8
Language: es
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Imports:
cli,
DBI,
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# covidmx 0.7.3

* Se corrige el issue #12 [cannot open file 'NA/2022.csv': No such file or directory](https://github.com/RodrigoZepeda/covidmx/issues/12).

* Se actualizó la versión de roxygen2: `RoxygenNote: 7.2.3`.

# covidmx 0.7.2

* Segundo intento de enviar a CRAN.
Expand Down
10 changes: 8 additions & 2 deletions R/descarga_datos_abiertos_aux.R
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,10 @@ unzip_db_datos_abiertos_tbl <- function(datos_abiertos_zip_paths,
filecon <- tryCatch(
{
unzip(datos_abiertos_zip_path, overwrite = TRUE)
fname <- list.files(pattern = "?.*COVID19.*.csv", full.names = T)[1]

#Get unzipped file name if changes
fname <- unzip(datos_abiertos_zip_path, list = T)$Name
fname <- list.files(pattern = fname, full.names = T)[1]
},
warning = function(cond) {

Expand Down Expand Up @@ -506,8 +509,11 @@ unzip_db_datos_abiertos_tbl <- function(datos_abiertos_zip_paths,
}

# Unzippeamos
fname <- system2(unzip_command, args = c("-l ", datos_abiertos_zip_path), stdout = TRUE)
fname <- grep(".*.csv", fname, value = TRUE)
fname <- sub(".*\\s","", fname)
system2(unzip_command, args = c(unzip_args, datos_abiertos_zip_path), stdout = !quiet)
fname <- list.files(pattern = ".*COVID19.*.csv", full.names = T)[1]
fname <- list.files(pattern = fname[1], full.names = T)[1]
},
error = function(cond) {
cli::cli_abort("No se puede leer {.file {datos_abiertos_zip_path}}")
Expand Down

0 comments on commit dbec219

Please sign in to comment.