Skip to content

Commit

Permalink
review2_part2
Browse files Browse the repository at this point in the history
- add assertions about input patameter maxIter and numInit
- package check
  • Loading branch information
giovsaraceno committed Jan 29, 2025
1 parent d3a3823 commit aa02595
Show file tree
Hide file tree
Showing 24 changed files with 171 additions and 172 deletions.
11 changes: 5 additions & 6 deletions R/clustering_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ setMethod("pkbc", signature(dat = "ANY"),
stop("nClust must be a single value or a numeric vector of possible
values")
}
if(is.vector(maxIter) & is.integer(maxIter)) {
if (maxIter < 0) {
if(is.vector(maxIter) & is.numeric(maxIter)) {
if (maxIter < 1) {
stop("Input parameter maxIter must be an integer greater than 0.")
}
} else {
Expand All @@ -190,8 +190,8 @@ setMethod("pkbc", signature(dat = "ANY"),
stop(paste("Unrecognized value ", initMethod, " in input
parameter initMethod.", sep=''))
}
if(is.vector(numInit) & is.integer(numInit)) {
if (numInit < 0) {
if(is.vector(numInit) & is.numeric(numInit)) {
if (numInit < 1) {
stop("Input parameter numInit must be greater than 0.")
}
} else {
Expand Down Expand Up @@ -567,7 +567,6 @@ setGeneric("stats_clusters",function(object,...) {
#'
#'
#' @srrstats {G1.4} roxigen2 is used
#' @srrstats {UL3.2} true label can be provided as a separate input
#' @srrstats {UL3.4} the function computes summary statistics with respect to
#' the identified clusters.
#'
Expand Down Expand Up @@ -660,7 +659,7 @@ setMethod("stats_clusters", "pkbc", function(object, k) {
#' component analysis for functional data." Test 8, 1–73.
#' https://doi.org/10.1007/BF02595862
#'
#'
#' @srrstats {UL3.2} true label can be provided as a separate input
#' @srrstats {UL6.1} this function includes a plot method
#' @srrstats {UL6.0,UL6.2} plot method for pkbc object
#'
Expand Down
12 changes: 6 additions & 6 deletions man/dpkb.Rd

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

10 changes: 5 additions & 5 deletions man/kb.test-class.Rd

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

16 changes: 8 additions & 8 deletions man/kb.test.Rd

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

4 changes: 2 additions & 2 deletions man/pk.test.Rd

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

22 changes: 11 additions & 11 deletions man/pkbc.Rd

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

16 changes: 8 additions & 8 deletions man/pkbc_validation.Rd

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

4 changes: 2 additions & 2 deletions man/plot.pkbc.Rd

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

10 changes: 5 additions & 5 deletions man/predict.pkbc.Rd

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

6 changes: 3 additions & 3 deletions man/select_h.Rd

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

4 changes: 2 additions & 2 deletions man/summary.pkbc.Rd

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

6 changes: 3 additions & 3 deletions tests/testthat/test-pkbc.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ test_that("Error is thrown for invalid inputs", {
"Input parameter nClust is required. Provide one specific
value or a set of possible values.", fixed=TRUE)
expect_error(pkbc(dat, nClust="invalid"),
"nClust must be a signle value or a numeric vector of possible
"nClust must be a single value or a numeric vector of possible
values", fixed=TRUE)

#Invalid maxIter
expect_error(pkbc(dat, nClust=2,maxIter=0),
"Input parameter maxIter must be greater than 0")
"Input parameter maxIter must be an integer greater than 0.")

#Invalid initMethod
expect_error(pkbc(dat, nClust=2,initMethod="Invalid"),
Expand All @@ -39,7 +39,7 @@ test_that("Error is thrown for invalid inputs", {

#Invalid numInit
expect_error(pkbc(dat, nClust=2,numInit=0),
"Input parameter numInit must be greater than 0")
"Input parameter numInit must be greater than 0.")
})

# Test 2: Verify Error on Invalid data
Expand Down
2 changes: 1 addition & 1 deletion vignettes/Introduction.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ library(QuadratiK)
## -----------------------------------------------------------------------------
x <- matrix(rnorm(100), ncol = 2)
# Does x come from a multivariate standard normal distribution?
kb.test(x, h=0.4)
kb.test(x, h = 0.4)

## -----------------------------------------------------------------------------
x <- matrix(rnorm(100,4), ncol = 2)
Expand Down
Loading

0 comments on commit aa02595

Please sign in to comment.