Skip to content
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: 2 additions & 0 deletions R/ds.kurtosis.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ ds.kurtosis <- function(x=NULL, method=1, type='both', datasources=NULL){
if(type == 'combine' | type == 'combined' | type == 'combines' | type == 'c') type <- 'combine'
if(type == 'split' | type == 'splits' | type == 's') type <- 'split'
if(type == 'both' | type == 'b' ) type <- 'both'
if(type != 'combine' & type != 'split' & type != 'both')
stop('Function argument "type" has to be either "both", "combine" or "split"', call.=FALSE)

# the input variable might be given as column table (i.e. D$x)
# or just as a vector not attached to a table (i.e. x)
Expand Down
4 changes: 3 additions & 1 deletion R/ds.skewness.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ ds.skewness <- function(x=NULL, method=1, type='both', datasources=NULL){
if(type == 'combine' | type == 'combined' | type == 'combines' | type == 'c') type <- 'combine'
if(type == 'split' | type == 'splits' | type == 's') type <- 'split'
if(type == 'both' | type == 'b' ) type <- 'both'

if(type != 'combine' & type != 'split' & type != 'both')
stop('Function argument "type" has to be either "both", "combine" or "split"', call.=FALSE)

# the input variable might be given as column table (i.e. D$x)
# or just as a vector not attached to a table (i.e. x)
# we have to make sure the function deals with each case
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-arg-ds.kurtosis.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test_that("setup", {
context("ds.kurtosis::arg::test errors")
test_that("kurtosis_erros", {
expect_error(ds.kurtosis(), "Please provide the name of the input vector!", fixed=TRUE)
res <- ds.kurtosis(x='D$LAB_TSC', type='datashield')
expect_true(is.null(res))
expect_error(ds.kurtosis(x='D$LAB_TSC', type='datashield'), "Function argument \"type\" has to be either \"both\", \"combine\" or \"split\"", fixed=TRUE)
expect_error(ds.kurtosis(x='D$LAB_TSC', method="0"), "method must be an integer between 1 and 3", fixed=TRUE)
expect_error(ds.kurtosis(x='D$LAB_TSC', method="4"), "method must be an integer between 1 and 3", fixed=TRUE)
})
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-arg-ds.skewness.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ test_that("setup", {
context("ds.skewness::arg::test errors")
test_that("skewness_erros", {
expect_error(ds.skewness(), "Please provide the name of the input vector!", fixed=TRUE)
res <- ds.skewness(x='D$LAB_TSC', type='datashield')
expect_true(is.null(res))
expect_error(ds.skewness(x='D$LAB_TSC', type='datashield'), "Function argument \"type\" has to be either \"both\", \"combine\" or \"split\"", fixed=TRUE)
expect_error(ds.skewness(x='D$LAB_TSC', method="0"), "method must be an integer between 1 and 3", fixed=TRUE)
expect_error(ds.skewness(x='D$LAB_TSC', method="4"), "method must be an integer between 1 and 3", fixed=TRUE)
})
Expand Down