diff --git a/R/chi2Corr.R b/R/chi2Corr.R index e3bdbbe..b2df6cd 100644 --- a/R/chi2Corr.R +++ b/R/chi2Corr.R @@ -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") diff --git a/R/chi2CorrAge.R b/R/chi2CorrAge.R index 0d0f67a..8ec8038 100644 --- a/R/chi2CorrAge.R +++ b/R/chi2CorrAge.R @@ -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") diff --git a/R/chi2CorrGUI.R b/R/chi2CorrGUI.R index 84ce0bb..b328c8b 100644 --- a/R/chi2CorrGUI.R +++ b/R/chi2CorrGUI.R @@ -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.")