Skip to content

Commit

Permalink
v0.1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
RichDeto committed Oct 30, 2020
1 parent c2fca18 commit 7b8f629
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
11 changes: 7 additions & 4 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,13 @@ age_groups <- function(data = ech::toy_ech_2018,
#'
#' @examples
#' toy_ech_2018 <- organize_ht11(data = ech::toy_ech_2018, year = 2018)
organize_ht11 <- function(data = ech::toy_ech_2018,
year = 2018,
ht11 = "ht11",
numero = "numero"){

organize_ht11 <- function(data, year, ht11 = "ht11", numero = "numero") {

assertthat::assert_that(is.data.frame(data), msg = glue:glue("Sorry... :( \n \t data parameter must be data.frame"))
assertthat::assert_that(is.numeric(year), msg = glue:glue("Sorry... :( \n \t year parameter must be a numeric value"))
assertthat::assert_that(ht11 %in% names(data), msg = glue:glue("Sorry... :( \n \t {ht11} is not in data"))
assertthat::assert_that(numero %in% names(data), msg = glue:glue("Sorry... :( \n \t {numero} is not in data"))

if (year %in% 2013:2015) {
data <- data %>%
Expand Down
7 changes: 1 addition & 6 deletions man/organize_ht11.Rd

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

2 changes: 1 addition & 1 deletion tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ test_that("utils works", {
expect_true("age_groups" %in% names(ech_2018))
ech_2018 <- age_groups(data = ech::toy_ech_2018, cut = c(2, 4, 11, 17, 24))
expect_true("age_groups" %in% names(ech_2018))
toy_ech_2018 <- organize_ht11(data = ech::toy_ech_2018, year = 2018)
toy_ech_2018 <- organize_ht11(data = ech::toy_ech_2018, year = 2014)
expect_equal(ncol(toy_ech_2018), 581)
})

0 comments on commit 7b8f629

Please sign in to comment.