Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #223 - General Issue: Next stage of deprecation cycles #224

Merged
merged 6 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Depends: R (>= 3.5)
Imports:
admiral,
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# admiralophtha 1.1.0

## Updates to Functions

- The following function arguments of `derive_var_afeye()` are entering the next phase of the deprecation process (#223):

* The argument `dataset_occ`
* The argument `lat_vals`

# admiralophtha 1.0.0

## Updates to Templates
Expand Down
14 changes: 5 additions & 9 deletions R/derive_var_afeye.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,34 +63,30 @@
derive_var_afeye <- function(dataset, dataset_occ, loc_var, lat_var, lat_vals, loc_vals = "EYE") {
# BEGIN DEPRECATION
if (!missing(lat_vals)) {
deprecate_warn(
"1.0.0",
deprecate_stop(
"1.1.0",
"derive_var_afeye(lat_vals = )",
details = "Please ensure your laterality values are from the
set `c('LEFT', 'RIGHT', 'BILATERAL')`"
)
} else {
lat_vals <- c("LEFT", "RIGHT", "BILATERAL")
ukey1025 marked this conversation as resolved.
Show resolved Hide resolved
}

if (!missing(dataset_occ)) {
deprecate_warn(
"1.0.0",
deprecate_stop(
"1.1.0",
"derive_var_afeye(dataset_occ = )",
"derive_var_afeye(dataset = )"
)
dataset <- dataset_occ
}

# END DEPRECATION
ukey1025 marked this conversation as resolved.
Show resolved Hide resolved

seye_vals <- c("LEFT", "RIGHT", "BILATERAL")
lat_vals <- c("LEFT", "RIGHT", "BILATERAL")

loc_var <- assert_symbol(enexpr(loc_var))
lat_var <- assert_symbol(enexpr(lat_var))

assert_character_vector(loc_vals)
assert_character_vector(seye_vals)
assert_character_vector(lat_vals)

assert_data_frame(dataset, required_vars = expr_c(
Expand Down
20 changes: 4 additions & 16 deletions tests/testthat/test-derive_var_afeye.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ test_that("derive_var_afeye Test 3: Deprecation of dataset_occ", {
"XXX001", "P01", "RIGHT", "", "", NA_character_,
)

expect_warning(
expect_error(
actual_output3 <- expected_output3 %>%
select(-AFEYE) %>%
derive_var_afeye(
Expand All @@ -77,13 +77,7 @@ test_that("derive_var_afeye Test 3: Deprecation of dataset_occ", {
loc_var = AELOC,
lat_var = AELAT
),
class = "lifecycle_warning_deprecated"
)

expect_dfs_equal(
actual_output3,
expected_output3,
keys = c("STUDYID", "USUBJID", "AELOC", "AELAT")
class = "lifecycle_error_deprecated"
)
})

Expand All @@ -96,20 +90,14 @@ test_that("derive_var_afeye Test 4: Deprecation of lat_vals", {
"XXX001", "P01", "RIGHT", "", "", NA_character_,
)

expect_warning(
expect_error(
actual_output4 <- expected_output4 %>%
select(-AFEYE) %>%
derive_var_afeye(
loc_var = AELOC,
lat_var = AELAT,
lat_vals = c("LEFT", "RIGHT", "BILATERAL")
),
class = "lifecycle_warning_deprecated"
)

expect_dfs_equal(
actual_output4,
expected_output4,
keys = c("STUDYID", "USUBJID", "AELOC", "AELAT")
class = "lifecycle_error_deprecated"
)
})
Loading