-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Allow using tidyselect helpers with `col_select` * Add some tests for tidyselect helpers * Update documentation * recid and partnership filter allow for recid and partnership filter when they are not specified to select in columns * Style package * update tests --------- Co-authored-by: Moohan <Moohan@users.noreply.github.com> Co-authored-by: Zihao Li <lizihao_anu@outlook.com> Co-authored-by: lizihao-anu <lizihao-anu@users.noreply.github.com>
- Loading branch information
1 parent
a69a61c
commit 0cb714f
Showing
9 changed files
with
112 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
skip_on_ci() | ||
|
||
|
||
test_that("tidyselect helpers work for column selection in the episode file", { | ||
expect_named( | ||
read_slf_episode("1920", col_select = dplyr::starts_with("dd")), | ||
c("dd_responsible_lca", "dd_quality") | ||
) | ||
expect_named( | ||
read_slf_episode("1920", col_select = c("year", dplyr::starts_with("dd"))), | ||
c("year", "dd_responsible_lca", "dd_quality") | ||
) | ||
expect_named( | ||
read_slf_episode("1920", col_select = !dplyr::matches("[aeiou]")) | ||
) | ||
}) | ||
|
||
test_that("col_select works when columns are added", { | ||
expect_named( | ||
read_slf_episode("1920", col_select = "year", recids = "DD"), | ||
"year" | ||
) | ||
expect_named( | ||
read_slf_episode("1920", col_select = "year", partnerships = "S37000001"), | ||
"year" | ||
) | ||
expect_named( | ||
read_slf_episode( | ||
"1920", | ||
col_select = c("year", dplyr::contains("dd")), | ||
recids = "DD" | ||
) | ||
) | ||
expect_named( | ||
read_slf_episode( | ||
"1920", | ||
col_select = c("year", dplyr::contains("cij")), | ||
partnerships = "S37000001" | ||
) | ||
) | ||
}) | ||
|
||
test_that("tidyselect helpers work for column selection in the individual file", { | ||
expect_named( | ||
read_slf_individual("1920", col_select = dplyr::starts_with("dd")), | ||
c("dd_noncode9_episodes", "dd_noncode9_beddays", "dd_code9_episodes", "dd_code9_beddays") | ||
) | ||
expect_named( | ||
read_slf_individual("1920", col_select = c("year", dplyr::starts_with("dd"))), | ||
c("year", "dd_noncode9_episodes", "dd_noncode9_beddays", "dd_code9_episodes", "dd_code9_beddays") | ||
) | ||
expect_named( | ||
read_slf_individual("1920", col_select = !dplyr::matches("[aeiou]")) | ||
) | ||
}) |