Skip to content

Commit c74488d

Browse files
committed
refactor: remove class from levelsDS return, update test
1 parent 885f61f commit c74488d

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

R/levelsDS.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
#' @description This function is similar to R function \code{levels}.
44
#' @details The function returns the levels of the input vector or list.
55
#' @param x a factor vector
6-
#' @return a list with two elements: \code{Levels} (the factor levels present
7-
#' in the vector) and \code{class} (the class of the input object, for
8-
#' client-side consistency checking)
6+
#' @return a list with one element: \code{Levels} (the factor levels present
7+
#' in the vector)
98
#' @author Alex Westerberg, for DataSHIELD Development Team
109
#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands
1110
#' @export
@@ -33,7 +32,7 @@ levelsDS <- function(x){
3332
stop("FAILED: Result length less than nfilter.levels.density of input length.", call. = FALSE)
3433
}
3534

36-
out.obj <- list(Levels=out, class=class(x.val))
35+
out.obj <- list(Levels=out)
3736
return(out.obj)
3837
}
3938
#AGGREGATE FUNCTION

tests/testthat/test-smk-levelsDS.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test_that("numeric vector levelsDS", {
2727

2828
res <- levelsDS("input")
2929

30-
expect_length(res, 2)
30+
expect_length(res, 1)
3131
expect_equal(class(res), "list")
3232
expect_equal(class(res$Levels), "character")
3333
expect_length(res$Levels, 4)

0 commit comments

Comments
 (0)