Skip to content

Commit

Permalink
missing eurostat tables replaced from examples and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Janne Huovari committed Jan 28, 2018
1 parent 8b68014 commit bac4fe2
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: eurostat
Type: Package
Title: Tools for Eurostat Open Data
Date: 2018-01-27
Date: 2018-01-28
Version: 3.1.5.9000
Encoding: UTF-8
Authors@R: c(
Expand Down
8 changes: 4 additions & 4 deletions R/eurotime2date.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
#' @return an object of class \code{\link{Date}}.
#' @author Janne Huovari \email{janne.huovari@@ptt.fi}
#' @examples \dontrun{
#' lp <- get_eurostat("namq_aux_lp", time_format = "raw")
#' lp$time <- eurotime2date(x = lp$time)
#' na_q <- get_eurostat("namq_10_pc", time_format = "raw")
#' na_q$time <- eurotime2date(x = na_q$time)
#'
#' un <- get_eurostat("une_rt_m", time_format = "raw")
#' un$time <- eurotime2date(x = un$time)
#'
#' lpa <- get_eurostat("nama_aux_lp", time_format = "raw")
#' lpa$time <- eurotime2date(x = lpa$time)
#' na_a <- get_eurostat("nama_10_pc", time_format = "raw")
#' na_a$time <- eurotime2date(x = na_a$time)
#'
#' eur_d <- get_eurostat("ert_bil_eur_d", time_format = "raw")
#' eur_d$time <- eurotime2date(x = eur_d$time)
Expand Down
8 changes: 4 additions & 4 deletions R/eurotime2num.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#' @return see \code{\link{as.numeric}}.
#' @author Janne Huovari \email{janne.huovari@@ptt.fi}
#' @examples \dontrun{
#' lp <- get_eurostat("namq_aux_lp", time_format = "raw")
#' lp$time <- eurotime2num(x = lp$time)
#' na_q <- get_eurostat("namq_10_pc", time_format = "raw")
#' na_q$time <- eurotime2num(x = na_q$time)
#'
#' un <- get_eurostat("une_rt_m", time_format = "raw")
#' un$time <- eurotime2num(x = un$time)
#'
#' lpa <- get_eurostat("nama_aux_lp", time_format = "raw")
#' lpa$time <- eurotime2num(x = lpa$time)
#' na_a <- get_eurostat("nama_10_pc", time_format = "raw")
#' na_a$time <- eurotime2num(x = na_a$time)
#' }
eurotime2num <- function(x){

Expand Down
8 changes: 4 additions & 4 deletions man/eurotime2date.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/eurotime2num.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions tests/testthat/test-all.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@ context("Get")
test_that("get_eurostat includes time and value",{
skip_on_cran()
expect_true(all(c("time", "values") %in%
names(get_eurostat("namq_aux_lp"))))
names(get_eurostat("road_eqr_trams"))))
})

test_that("get_eurostat works with multi-frequency",{
skip_on_cran()
expect_error(get_eurostat("avia_gonc", cache = FALSE))
matches("-01-01", unique(get_eurostat("avia_gonc", select_time = "Y" , cache = FALSE)$time))
expect_match(as.character(unique(get_eurostat("avia_gonc", select_time = "Y" ,
cache = FALSE)$time)), "-01-01")
})

test_that("get_eurostat return right classes",{
skip_on_cran()
expect_true(all(c("factor", "numeric") %in%
sapply(get_eurostat("namq_aux_lp"), class)))
sapply(get_eurostat("road_eqr_trams"), class)))
expect_true(all(c("character", "numeric") %in%
sapply(get_eurostat("namq_aux_lp", stringsAsFactors = FALSE),
sapply(get_eurostat("road_eqr_trams", stringsAsFactors = FALSE),
class)))
})

Expand Down Expand Up @@ -74,7 +75,7 @@ test_that("Variable names are labeled",{
expect_equal(label_eurostat_vars("indic_na", lang = "fr"), "Indicateur des comptes nationaux")
expect_true(any(grepl("_code",
names(label_eurostat(
get_eurostat("namq_aux_lp"), code = "geo")))))
get_eurostat("road_eqr_trams"), code = "geo")))))
})

test_that("Label ordering is ordered", {
Expand Down Expand Up @@ -114,7 +115,7 @@ flag_dat <- get_eurostat("tsdtr210", type = "label", keepFlags=T, cache = FALSE)
test_that("get_eurostat includes flags",{
skip_on_cran()
expect_true(all(c("flags") %in%
names(get_eurostat("namq_aux_lp", keepFlags = TRUE))))
names(get_eurostat("road_eqr_trams", keepFlags = TRUE))))
})

test_that("keepFlags + label as in #61",{
Expand All @@ -133,10 +134,10 @@ context("json")

test_that("Get json data",{
skip_on_cran()
expect_named(get_eurostat_json("nama_gdp_c", filters = list(geo=c("EU28", "FI"),
unit="EUR_HAB",
indic_na="B1GM")),
c("geo", "unit", "indic_na", "time", "values"),
expect_named(get_eurostat_json("nama_10_gdp", filters = list(geo = "FI",
na_item = "B1GQ",
unit = "CLV_I10")),
c("geo", "unit", "na_item", "time", "values"),
ignore.order = TRUE)
})

Expand Down

0 comments on commit bac4fe2

Please sign in to comment.