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 #237: deprecation #251

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
11 changes: 10 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# admiralophtha 1.1.0.9006
# admiralophtha 1.2.0.

## Updates to Functions

- The following function arguments of `derive_var_afeye()` are removed following the end of their deprecation cycle (#237):

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

# admiralophtha 1.1.0.

## Updates to Functions

Expand Down
25 changes: 1 addition & 24 deletions R/derive_var_afeye.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
#' Derive Affected Eye (`AFEYE`) in occurrence datasets
#'
#' @param dataset Input dataset
#' @param dataset_occ Input dataset
#'
#' `r lifecycle::badge("deprecated")` Please use `dataset` instead.
#'
#' @param loc_var Location variable
#' @param lat_var Laterality variable
#' @param loc_vals `xxLOC` values for which `AFEYE` is derived
#' @param lat_vals `xxLAT`values for which `AFEYE` is derived
#'
#' `r lifecycle::badge("deprecated")` Please simply ensure `xxLAT` values are
#' contained in `c("LEFT", "RIGHT", "BILATERAL")`.
Expand Down Expand Up @@ -60,29 +58,8 @@
#' )
#'
#' derive_var_afeye(adae2, loc_var = AELOC, lat_var = AELAT, loc_vals = c("EYES", "RETINA"))
derive_var_afeye <- function(dataset, dataset_occ, loc_var, lat_var, lat_vals, loc_vals = "EYE") {
# BEGIN DEPRECATION
if (!missing(lat_vals)) {
deprecate_stop(
"1.1.0",
"derive_var_afeye(lat_vals = )",
details = "Please ensure your laterality values are from the
set `c('LEFT', 'RIGHT', 'BILATERAL')`"
)
}

if (!missing(dataset_occ)) {
deprecate_stop(
"1.1.0",
"derive_var_afeye(dataset_occ = )",
"derive_var_afeye(dataset = )"
)
}

# END DEPRECATION

derive_var_afeye <- function(dataset, loc_var, lat_var, loc_vals = "EYE") {
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))
Expand Down
17 changes: 3 additions & 14 deletions man/derive_var_afeye.Rd

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

43 changes: 0 additions & 43 deletions tests/testthat/test-derive_var_afeye.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,46 +58,3 @@ test_that("derive_var_afeye Test 2: AFEYE is derived correctly when parsing loc_
keys = c("STUDYID", "USUBJID", "AELOC", "AELAT")
)
})

## Test 3: Deprecation of dataset_occ ----
test_that("derive_var_afeye Test 3: Deprecation of dataset_occ", {
expected_output3 <- tibble::tribble(
~STUDYID, ~USUBJID, ~STUDYEYE, ~AELOC, ~AELAT, ~AFEYE,
"XXX001", "P01", "RIGHT", "EYE", "RIGHT", "Study Eye",
"XXX001", "P01", "RIGHT", "EYE", "LEFT", "Fellow Eye",
"XXX001", "P01", "RIGHT", "", "", NA_character_,
)

expect_error(
actual_output3 <- expected_output3 %>%
select(-AFEYE) %>%
derive_var_afeye(
dataset = NULL,
dataset_occ = .,
loc_var = AELOC,
lat_var = AELAT
),
class = "lifecycle_error_deprecated"
)
})

## Test 4: Deprecation of lat_vals ----
test_that("derive_var_afeye Test 4: Deprecation of lat_vals", {
expected_output4 <- tibble::tribble(
~STUDYID, ~USUBJID, ~STUDYEYE, ~AELOC, ~AELAT, ~AFEYE,
"XXX001", "P01", "RIGHT", "EYE", "RIGHT", "Study Eye",
"XXX001", "P01", "RIGHT", "EYE", "LEFT", "Fellow Eye",
"XXX001", "P01", "RIGHT", "", "", NA_character_,
)

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_error_deprecated"
)
})
Loading