Skip to content

Commit

Permalink
Replace 'if(class() == )' by 'inherits()'
Browse files Browse the repository at this point in the history
  • Loading branch information
aursiber committed Jan 19, 2024
1 parent 5ca91c9 commit 3c6583e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/chi2Corr.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ chi2Corr <- function(formula, data.obs, namepara1, namepara2, nsimu) {
## check validity
if(nsimu <= 0 | is.na(nsimu) | !is.numeric(nsimu))
stop("'nsimu' must be a positive number")
if(class(formula) != "character")
if(!inherits(formula, "character"))
stop("'formula' must be a string of character")
if(!is.character(namepara1) | !is.character(namepara2))
stop("'namepara1' and 'namepara2' must be strings of character")
Expand Down
2 changes: 1 addition & 1 deletion R/chi2CorrAge.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ chi2CorrAge <- function(formula, data.obs, namepara1, namepara2, nameage, w1, w2
stop("'mort' and 'a' must be numeric")
if(length(a) != length(mort) + 1)
stop("'mort' must have the length of 'a' plus 1")
if(class(formula) != "character")
if(!inherits(formula, "character"))
stop("'formula' must be a string of character")
if(!is.character(namepara1) | !is.character(namepara2) | !is.character(nameage))
stop("'namepara1', 'namepara2' and 'nameage' must be strings of character")
Expand Down
2 changes: 1 addition & 1 deletion R/chi2CorrGUI.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ of serological statuses", font = font2), choose.par)

if(length(ParChoice) != 2)
tkmessageBox(message = "Please select the two columns of serologic statuses.")
else if(class(formul) != "character")
else if(!inherits(formul, "character"))
tkmessageBox(message = "Please enter a model formula.")
else if(sim <= 0 | is.na(sim) | !is.numeric(sim))
tkmessageBox(message = "Please enter a positive number of simulations.")
Expand Down

0 comments on commit 3c6583e

Please sign in to comment.