From e9a57a6542f610ecf18c963b2e1b7502932a0499 Mon Sep 17 00:00:00 2001 From: rafapereirabr Date: Thu, 29 Jun 2023 20:33:16 -0300 Subject: [PATCH] new v0.3.0 --- CRAN-SUBMISSION | 6 +- DESCRIPTION | 3 +- NEWS.md | 8 +- R/read_airfares.R | 5 + R/utils.R | 5 + cran-comments.md | 20 ++- .../test_get_airfares_dates_available.R | 50 +++---- tests/testthat/test_read_airfares.R | 126 +++++++++--------- tests_rafa/test_rafa.R | 3 - 9 files changed, 121 insertions(+), 105 deletions(-) diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 3d92171..b95b93a 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ -Version: 0.2.1 -Date: 2022-11-26 11:01:40 UTC -SHA: f513d574a0f17e679f46baef775f53bbc4316fe0 +Version: 0.3.0 +Date: 2023-06-28 18:10:10 UTC +SHA: cbb705a27facf6cac75c643b33241cda834f2d6b diff --git a/DESCRIPTION b/DESCRIPTION index 15e68cb..55a0624 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,7 @@ Type: Package Package: flightsbr Title: Download Flight and Airport Data from Brazil -Version: 0.2.1 -Date: 2022-11-25 +Version: 0.3.0 Authors@R: c(person(given="Rafael H. M.", family="Pereira", email="rafa.pereira.br@gmail.com", diff --git a/NEWS.md b/NEWS.md index e6202b4..660f9a5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,13 @@ -# flightsbr v0.2.1999 (dev) +# flightsbr v0.3.0 + + +* Major changes: + * Function read_airfares() is temporarily unavailable. See issue [#30](https://github.com/ipeaGIT/flightsbr/issues/30) * Minor changes: * Function `read_flights()` now accepts a vector of dates. Closed #29. - + * Bug fixes: * Fixed broken link for data dictionary for airport movement data * Fixed code to rbindlist air fares from multiple years. Closed #26. diff --git a/R/read_airfares.R b/R/read_airfares.R index c2f72ed..776e4d2 100644 --- a/R/read_airfares.R +++ b/R/read_airfares.R @@ -31,6 +31,11 @@ #'}} read_airfares <- function(date = 202001, domestic = TRUE, showProgress = TRUE, select = NULL){ + message("Function read_airfares() is temporarily unavailable. See issue #30 https://github.com/ipeaGIT/flightsbr/issues/30") + return(NULL) + + stop() + ### check inputs if( ! is.logical(domestic) ){ stop(paste0("Argument 'domestic' must be either 'TRUE' or 'FALSE.")) } if( ! is.logical(showProgress) ){ stop(paste0("Argument 'showProgress' must be either 'TRUE' or 'FALSE.")) } diff --git a/R/utils.R b/R/utils.R index 638cc04..6bab50d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -146,6 +146,11 @@ get_airport_movement_dates_available <- function(date=NULL) { #'}} get_airfares_dates_available <- function(dom) { + message("Function read_airfares() is temporarily unavailable. See issue #30 https://github.com/ipeaGIT/flightsbr/issues/30") + return(NULL) + + stop() + if( ! is.logical(dom) ){ stop(paste0("Argument 'dom' must be either 'TRUE' or 'FALSE.")) } # read html table diff --git a/cran-comments.md b/cran-comments.md index 4dc222d..d6992db 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,15 +1,21 @@ ## R CMD check results --- R CMD check results --------------------------- flightsbr 0.2.1 ---- -Duration: 7m 48.8s +── R CMD check results ──────────────────────────────────────────────────────────────── flightsbr 0.2.1 ──── +Duration: 3m 21.4s -0 errors v | 0 warnings v | 0 notes v +0 errors ✔ | 0 warnings ✔ | 0 notes ✔ -## flightsbr v0.2.1 +## flightsbr v0.3.0 -* Bug fixes: - * Fixed bug in `read_flights()` due to changes in ANAC data links. - * Fixed broken link in `intro_flightsbr` vignette +* Major changes: + * Function read_airfares() is temporarily unavailable. See issue [#30](https://github.com/ipeaGIT/flightsbr/issues/30) +* Minor changes: + * Function `read_flights()` now accepts a vector of dates. Closed #29. +* Bug fixes: + * Fixed broken link for data dictionary for airport movement data + * Fixed code to rbindlist air fares from multiple years. Closed #26. + * Fixed code to read a few dates that were not caught in `get_airfares_dates_available()` because of ".CSV" in ANAC url. Closed #27. + * Fixed code to use `get_airport_movement_dates_available()` diff --git a/tests/testthat/test_get_airfares_dates_available.R b/tests/testthat/test_get_airfares_dates_available.R index 07fcd11..26109b4 100644 --- a/tests/testthat/test_get_airfares_dates_available.R +++ b/tests/testthat/test_get_airfares_dates_available.R @@ -1,25 +1,25 @@ -context("") - -# skip tests because they take too much time -skip_if(Sys.getenv("TEST_ONE") != "") -testthat::skip_on_cran() - - -# get_airfares_dates_available ----------------------- - -test_that("get_airfares_dates_available", { - - fares1 <- get_airfares_dates_available(dom = TRUE) - fares2 <- get_airfares_dates_available(dom = FALSE) - - testthat::expect_true(class(fares1) == "numeric") - testthat::expect_true(class(fares2) == "numeric") - - testthat::expect_true( length(fares1) >0 ) - testthat::expect_true( length(fares2) >0 ) - - - testthat::expect_error(fares1()) - testthat::expect_error(fares2(dom = 999)) -}) - +# context("") +# +# # skip tests because they take too much time +# skip_if(Sys.getenv("TEST_ONE") != "") +# testthat::skip_on_cran() +# +# +# # get_airfares_dates_available ----------------------- +# +# test_that("get_airfares_dates_available", { +# +# fares1 <- get_airfares_dates_available(dom = TRUE) +# fares2 <- get_airfares_dates_available(dom = FALSE) +# +# testthat::expect_true(class(fares1) == "numeric") +# testthat::expect_true(class(fares2) == "numeric") +# +# testthat::expect_true( length(fares1) >0 ) +# testthat::expect_true( length(fares2) >0 ) +# +# +# testthat::expect_error(fares1()) +# testthat::expect_error(fares2(dom = 999)) +# }) +# diff --git a/tests/testthat/test_read_airfares.R b/tests/testthat/test_read_airfares.R index 26cf51e..d06e779 100644 --- a/tests/testthat/test_read_airfares.R +++ b/tests/testthat/test_read_airfares.R @@ -1,63 +1,63 @@ -context("read_airfares") - -# skip tests because they take too much time -skip_if(Sys.getenv("TEST_ONE") != "") -testthat::skip_on_cran() - - -# Reading the data ----------------------- - -test_that("read_airfares", { - - # (default), one month, basica, progress - test1 <- read_airfares() - testthat::expect_true(is(test1, "data.table")) - testthat::expect_true(nrow(test1) >0 ) - - test2 <- read_airfares(domestic = FALSE) - testthat::expect_true(is(test2, "data.table")) - testthat::expect_true(nrow(test2) >0 ) - - - # one month, combinada, no progress bar - test3 <- read_airfares(date=200401, showProgress = FALSE) - testthat::expect_true(is(test3, "data.table")) - testthat::expect_true(nrow(test3) >0 ) - - test4 <- read_airfares(date=201202, showProgress = FALSE, domestic = FALSE) - testthat::expect_true(is(test4, "data.table")) - testthat::expect_true(nrow(test4) >0 ) - - # check content - testthat::expect_equal( as.character(min(test3$ANO)), as.character("2004") ) - testthat::expect_equal( as.character(min(test4$ANO)), as.character("2012") ) - - # all months in a year - test5 <- read_airfares(date=2022, select='Tarifa-N', showProgress = FALSE) - testthat::expect_true(is(test5, "data.table")) - - test6 <- read_airfares(date=2022, domestic = FALSE, showProgress = FALSE, select='VALOR_TARIFA') - testthat::expect_true(is(test6, "data.table")) - - }) - - -# ERRORS and messages ----------------------- -test_that("read_airfares", { - - # Wrong date 4 digits - testthat::expect_error(read_airfares(date=1990)) - testthat::expect_error(read_airfares(date=9999)) - testthat::expect_error(read_airfares(date=1990, domestic=FALSE)) - testthat::expect_error(read_airfares(date=9999, domestic=FALSE)) - - # Wrong date 6 digits - testthat::expect_error(read_airfares(date=199001)) - testthat::expect_error(read_airfares(date=999901)) - testthat::expect_error(read_airfares(date=199001, domestic=FALSE)) - testthat::expect_error(read_airfares(date=999901, domestic=FALSE)) - - # Wrong type and showProgress - testthat::expect_error(read_airfares(showProgress='banana')) - testthat::expect_warning(read_airfares(select='banana')) -}) +# context("read_airfares") +# +# # skip tests because they take too much time +# skip_if(Sys.getenv("TEST_ONE") != "") +# testthat::skip_on_cran() +# +# +# # Reading the data ----------------------- +# +# test_that("read_airfares", { +# +# # (default), one month, basica, progress +# test1 <- read_airfares() +# testthat::expect_true(is(test1, "data.table")) +# testthat::expect_true(nrow(test1) >0 ) +# +# test2 <- read_airfares(domestic = FALSE) +# testthat::expect_true(is(test2, "data.table")) +# testthat::expect_true(nrow(test2) >0 ) +# +# +# # one month, combinada, no progress bar +# test3 <- read_airfares(date=200401, showProgress = FALSE) +# testthat::expect_true(is(test3, "data.table")) +# testthat::expect_true(nrow(test3) >0 ) +# +# test4 <- read_airfares(date=201202, showProgress = FALSE, domestic = FALSE) +# testthat::expect_true(is(test4, "data.table")) +# testthat::expect_true(nrow(test4) >0 ) +# +# # check content +# testthat::expect_equal( as.character(min(test3$ANO)), as.character("2004") ) +# testthat::expect_equal( as.character(min(test4$ANO)), as.character("2012") ) +# +# # all months in a year +# test5 <- read_airfares(date=2022, select='Tarifa-N', showProgress = FALSE) +# testthat::expect_true(is(test5, "data.table")) +# +# test6 <- read_airfares(date=2022, domestic = FALSE, showProgress = FALSE, select='VALOR_TARIFA') +# testthat::expect_true(is(test6, "data.table")) +# +# }) +# +# +# # ERRORS and messages ----------------------- +# test_that("read_airfares", { +# +# # Wrong date 4 digits +# testthat::expect_error(read_airfares(date=1990)) +# testthat::expect_error(read_airfares(date=9999)) +# testthat::expect_error(read_airfares(date=1990, domestic=FALSE)) +# testthat::expect_error(read_airfares(date=9999, domestic=FALSE)) +# +# # Wrong date 6 digits +# testthat::expect_error(read_airfares(date=199001)) +# testthat::expect_error(read_airfares(date=999901)) +# testthat::expect_error(read_airfares(date=199001, domestic=FALSE)) +# testthat::expect_error(read_airfares(date=999901, domestic=FALSE)) +# +# # Wrong type and showProgress +# testthat::expect_error(read_airfares(showProgress='banana')) +# testthat::expect_warning(read_airfares(select='banana')) +# }) diff --git a/tests_rafa/test_rafa.R b/tests_rafa/test_rafa.R index 4fc6b9d..7db57b3 100644 --- a/tests_rafa/test_rafa.R +++ b/tests_rafa/test_rafa.R @@ -22,9 +22,6 @@ https://dados.gov.br/dataset/aeronaves-registradas-no-registro-aeronautico-brasi -a <- flightsbr::read_airport_movements(date = 2022, showProgress = FALSE) - - ##### tarifas aereas ------------------------ https://www.gov.br/anac/pt-br/pt-br/assuntos/dados-e-estatisticas/mercado-do-transporte-aereo