Skip to content

Commit c68ba65

Browse files
committed
add dependencies for recordLinkage
1 parent 0d6f0c2 commit c68ba65

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ LinkingTo: Rcpp
2525
Depends:
2626
R (>= 2.10)
2727
Suggests:
28+
cluster,
29+
clue,
2830
laeken,
2931
parallel,
3032
testthat,

R/recordLinkage.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ recordLinkage <- function(x,
169169
if (!is.numeric(tol) || length(tol) != 1L || !is.finite(tol) || tol < 0) {
170170
stop("`tol` must be a single non-negative finite number.", call. = FALSE)
171171
}
172+
if (!requireNamespace("clue", quietly = TRUE)) {
173+
stop("Package 'clue' is required for this function.", call. = FALSE)
174+
}
175+
if (!requireNamespace("cluster", quietly = TRUE)) {
176+
stop("Package 'cluster' is required for this function.", call. = FALSE)
177+
}
172178

173179
# identifier handling --------------------------------------------------------
174180
if (is.null(x_id)) {

tests/testthat/test_recordLinkage.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# load library
44
library(testthat)
55

6+
testthat::skip_if_not_installed("clue")
7+
testthat::skip_if_not_installed("cluster")
8+
69
test_that("recordLinkage returns correct match rate (example 1 from Harrenz et al. (2015))", {
710
x <- data.frame(
811
v1 = c(1, 0, -1, 0),

0 commit comments

Comments
 (0)