Skip to content

Commit

Permalink
Update download.R to include new BACI link (#248)
Browse files Browse the repository at this point in the history
* Update download.R to include new BACI link

All references to the older V202201 version of the BACI dataset are changed to the most up to date version, the V202401b.

* baci: updating docs

---------

Co-authored-by: Igor Rigolon <igor.rilave@hotmail.com>
  • Loading branch information
OlivazShai and IgorRigolon authored Sep 4, 2024
1 parent 81827dc commit 5f0a8ab
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: datazoom.amazonia
Title: Simplify Access to Data from the Amazon Region
Version: 1.1.0.9000
Version: 1.1.1.9000
Authors@R: c(
person("Igor", "Rigolon Veiga", , "igor.rilave@hotmail.com", role = c("aut", "cre")),
person("DataZoom (PUC-Rio)", , , "datazoom@econ.puc-rio.br", role = "fnd"),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# datazoom.amazonia 1.1.1.9000

* Updated `load_baci` to support the newest version of the data, fixing the previous broken download URL. (Thanks to @OlivazShai)

# datazoom.amazonia 1.1.0.9000 (development version)

* Updated `load_prodes` data cleaning and download to allow more recent data
Expand Down
2 changes: 1 addition & 1 deletion R/check_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ check_params <- function(param) {
if (!all(param$time_period %in% supp_time_period)) {
time_period_error <- paste("Option time_period must be in", supp_time_period_str)

stop(time_period_error)
warning(time_period_error)
}
}

Expand Down
8 changes: 4 additions & 4 deletions R/download.R
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,10 @@ external_download <- function(dataset = NULL, source = NULL, year = NULL,
}

if (param$source == "baci") {
# as year can be a vector, sets up expressions of the form "*YYYY_V202201.csv" for each year to match file names
file_expression <- paste0("*", param$year, "_V202201.csv")
# as year can be a vector, sets up expressions of the form "*YYYY_V202401b.csv" for each year to match file names
file_expression <- paste0("*", param$year, "_V202401b.csv")

# now turning into *XXXX_V202201.csv|YYYY_V202201.csv|ZZZZ_V202201.csv" to match as regex
# now turning into *XXXX_V202401b.csv|YYYY_V202401b.csv|ZZZZ_V202401b.csv" to match as regex
file_expression <- paste0(file_expression, collapse = "|")

file <- list.files(dir, pattern = file_expression, full.names = TRUE) %>%
Expand Down Expand Up @@ -817,7 +817,7 @@ datasets_link <- function(source = NULL, dataset = NULL, url = FALSE) {

## BACI

"baci", "HS92", NA, "1995-2020", "Country", "http://www.cepii.fr/DATA_DOWNLOAD/baci/data/baci_HS92_V202201.zip",
"baci", "HS92", NA, "1995-2022", "Country", "https://www.cepii.fr/DATA_DOWNLOAD/baci/data/baci_HS92_V202401b.zip",

## PIB-Munic

Expand Down

0 comments on commit 5f0a8ab

Please sign in to comment.