Skip to content

Commit 1ff323f

Browse files
committed
revert: remove batch-4 cDS/listDS work leaked onto batch-3
1 parent b8ba480 commit 1ff323f

6 files changed

Lines changed: 33 additions & 42 deletions

File tree

R/cDS.R

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,27 @@
33
#' @description This function is similar to the R base function 'c'.
44
#' @details Unlike the R base function 'c' on vector or list of certain
55
#' length are allowed as output
6-
#' @param x.names a character vector of object names to concatenate.
6+
#' @param objs a list which contains the the objects to concatenate.
77
#' @return a vector or list
88
#' @author Gaye, A.
9-
#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands
109
#' @export
11-
#'
12-
cDS <- function (x.names) {
13-
10+
#'
11+
cDS <- function (objs) {
12+
1413
# Check Permissive Privacy Control Level.
1514
dsBase::checkPermissivePrivacyControlLevel(c('permissive', 'avocado'))
16-
17-
# this filter sets the minimum number of observations that are allowed
15+
16+
# this filter sets the minimum number of observations that are allowed
1817

1918
#############################################################
2019
# MODULE 1: CAPTURE THE nfilter SETTINGS
2120
thr <- dsBase::listDisclosureSettingsDS()
2221
nfilter.tab <- as.numeric(thr$nfilter.tab)
22+
#nfilter.glm <- as.numeric(thr$nfilter.glm)
23+
#nfilter.subset <- as.numeric(thr$nfilter.subset)
24+
#nfilter.string <- as.numeric(thr$nfilter.string)
2325
#############################################################
24-
25-
objs <- list()
26-
for (i in seq_along(x.names)) {
27-
objs[[i]] <- .loadServersideObject(x.names[i])
28-
}
26+
2927
x <- unlist(objs)
3028

3129
# check if the output is valid and output accordingly

R/listDS.R

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,17 @@
33
#' @description this function is similar to R function 'list'
44
#' @details Unlike the R function 'list' it takes also a vector of characters,
55
#' the names of the elements in the output list.
6-
#' @param x.names a character vector of object names to coerce into a list.
7-
#' @param eltnames a character vector, the names of the elements in the list.
6+
#' @param input a list of objects to coerce into a list
7+
#' @param eltnames a character list, the names of the elements in the list.
88
#' @return a list
99
#' @author Gaye, A.
10-
#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands
1110
#' @export
12-
#'
13-
listDS <-function (x.names=NULL, eltnames=NULL){
14-
15-
mylist <- list()
16-
for (i in seq_along(x.names)) {
17-
mylist[[i]] <- .loadServersideObject(x.names[i])
18-
}
11+
#'
12+
listDS <-function (input=NULL, eltnames=NULL){
13+
14+
mylist <- input
1915
names(mylist) <- unlist(eltnames)
2016

2117
return(mylist)
22-
18+
2319
}

man/cDS.Rd

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/listDS.Rd

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-smk-cDS.R

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ set.standard.disclosure.settings()
2323

2424
# context("cDS::smk::numeric list")
2525
test_that("numeric list cDS", {
26-
a <- 0.0; b <- 1.0; c <- 2.0; d <- 3.0
26+
input <- list(a=0.0, b=1.0, c=2.0, d=3.0)
2727

28-
res <- cDS(c("a", "b", "c", "d"))
28+
res <- cDS(input)
2929

3030
expect_length(res, 4)
3131
expect_equal(class(res), "numeric")
@@ -37,9 +37,9 @@ test_that("numeric list cDS", {
3737

3838
# context("cDS::smk::character list")
3939
test_that("character list cDS", {
40-
a <- "0.0"; b <- "1.0"; c <- "2.0"; d <- "3.0"
40+
input <- list(a="0.0", b="1.0", c="2.0", d="3.0")
4141

42-
res <- cDS(c("a", "b", "c", "d"))
42+
res <- cDS(input)
4343

4444
expect_length(res, 4)
4545
expect_equal(class(res), "character")
@@ -51,9 +51,9 @@ test_that("character list cDS", {
5151

5252
# context("cDS::smk::numeric list small")
5353
test_that("single numeric list small cDS", {
54-
a <- 0; b <- 1
54+
input <- list(a=0, b=1)
5555

56-
res <- cDS(c("a", "b"))
56+
res <- cDS(input)
5757

5858
expect_length(res, 2)
5959
expect_equal(class(res), "logical")
@@ -63,7 +63,9 @@ test_that("single numeric list small cDS", {
6363

6464
# context("cDS::smk::empty list")
6565
test_that("empty list cDS", {
66-
res <- cDS(character(0))
66+
input <- list()
67+
68+
res <- cDS(input)
6769

6870
expect_length(res, 0)
6971
expect_equal(class(res), "NULL")

tests/testthat/test-smk-listDS.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121

2222
# context("listDS::smk::simple")
2323
test_that("simple listDS", {
24-
v1 <- c(1, 2, 3)
25-
v2 <- c(4, 5, 6)
24+
input <- list(v1 = c(1, 2, 3), v2 = c(4, 5, 6))
2625
eltnames <- c('n1', 'n2')
2726

28-
res <- listDS(c("v1", "v2"), eltnames)
27+
res <- listDS(input, eltnames)
2928

3029
expect_equal(class(res), "list")
3130
expect_length(res, 2)

0 commit comments

Comments
 (0)