I am sorry.. The code is here and data is provided at the end of this email. data = readARFF("aho.arff") index= sample(1:nrow(data), 0.7*nrow(data)) train= data[index,] test= data[-index,] task = TaskClassif$new("data", backend = train, target = "isKilled") learner= lrn("classif.randomForest", predict_type = "prob") model= learner$train(task ) ///explainer is created to identify a bias in a particular feature i.e. CE feature in this case explainer = explain_mlr3(model, data = test[,-15], y = as.numeric(test$isKilled)-1, label="RF") prot <- ifelse(test$CE == '2', 1, 0) /// Error comes here privileged <- '1' fc= fairness_check(explainer, protected = prot, privileged = privileged) plot(fc) ////////////////////////////////////////// my data is dput(test) structure(list(DepthTree = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 1), NumSubclass = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2), Instability = c(0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0, 0, 0, 0, 0.667, 0.667), numCovered = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 54, 54, 54, 123, 54, 54, 39, 84, 54, 54, 15, 138, 189, 189, 189, 27, 51, 33, 6, 27, 27, 150, 150, 150, 54, 150, 54, 54, 150, 117, 51, 66, 60, 15, 15, 72, 12, 45, 255, 255, 129, 129, 129, 0, 129, 0, 0, 6, 6, 6, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 12, 12, 12, 18, 12, 12, 48, 12, 1557, 48, 12, 171, 0, 0, 0, 141, 141, 45, 141, 18, 39), operator = structure(c(4L, 13L, 13L, 1L, 4L, 9L, 12L, 4L, 11L, 4L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, 7L, 8L, 8L, 6L, 7L, 8L, 4L, 1L, 2L, 3L, 4L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, 11L, 12L, 12L, 4L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 6L, 9L, 9L, 4L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 10L, 1L, 1L, 1L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 13L, 13L, 7L, 8L, 8L, 9L, 8L, 8L, 8L, 8L, 9L, 10L, 1L, 4L, 4L, 6L, 7L, 8L, 8L, 8L, 9L, 10L, 10L, 7L, 8L, 8L, 10L, 11L, 11L, 7L, 8L, 4L, 8L, 9L, 10L, 10L, 4L, 10L, 7L, 7L, 10L, 6L, 8L, 8L, 10L, 8L, 8L, 10L, 9L, 8L, 10L, 7L, 7L, 13L, 2L, 2L, 2L, 8L, 8L, 8L, 8L, 8L, 11L, 10L, 10L, 13L, 13L, 8L, 8L, 8L, 6L, 7L, 8L, 10L, 13L, 13L), .Label = c("T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "T11", "T12", "T13", "T14", "T15"), class = "factor"), methodReturn = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 3L, 3L, 3L, 1L, 4L, 4L, 4L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 2L, 2L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 2L, 2L), .Label = c("I", "V", "Z", "method", "D", "[D", "[[D", "J", "[I", "C", "[J", "[C", "[S", "F", "[F", "[B", "S", "B", "[Z", "[[S", "[[B", "[[Z"), class = "factor"), numTestsCover = c(16, 16, 16, 15, 15, 16, 15, 4, 16, 16, 15, 16, 15, 15, 15, 15, 15, 3, 3, 3, 2, 16, 11, 4, 16, 3, 16, 16, 16, 16, 16, 4, 16, 16, 16, 4, 16, 16, 3, 3, 3, 2, 4, 3, 2, 1, 4, 1, 15, 16, 15, 2, 3, 2, 3, 3, 2, 2, 2, 3, 4, 5, 5, 5, 4, 5, 5, 4, 4, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 6, 6, 6, 0, 6, 0, 0, 2, 2, 2, 7, 0, 0, 0, 15, 16, 16, 16, 15, 17, 17, 17, 15, 5, 4, 4, 4, 3, 4, 4, 3, 4, 16, 16, 4, 17, 0, 0, 0, 5, 5, 3, 5, 2, 3), mutantAssert = c(55, 55, 55, 55, 55, 55, 55, 13, 55, 55, 55, 55, 55, 55, 55, 55, 55, 9, 9, 9, 9, 55, 41, 13, 55, 5, 55, 55, 55, 55, 55, 13, 55, 55, 55, 13, 55, 55, 13, 13, 13, 8, 13, 13, 8, 4, 13, 4, 55, 55, 55, 9, 9, 9, 9, 9, 9, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 9, 9, 9, 14, 14, 14, 0, 14, 0, 0, 2, 2, 2, 15, 0, 0, 0, 55, 58, 58, 55, 55, 58, 58, 58, 55, 9, 6, 6, 6, 6, 6, 6, 6, 6, 55, 55, 13, 57, 0, 0, 0, 11, 11, 7, 11, 9, 9), classAssert = c(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 1, 1, 1, 1, 3, 3, 3, 3, 0, 0), isKilled = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L), .Label = c("yes", "no"), class = "factor")), row.names = c(3L, 4L, 5L, 7L, 9L, 17L, 20L, 21L, 26L, 28L, 32L, 33L, 40L, 43L, 45L, 49L, 54L, 62L, 64L, 65L, 70L, 75L, 77L, 81L, 84L, 86L, 88L, 89L, 93L, 95L, 97L, 99L, 101L, 102L, 106L, 111L, 112L, 113L, 118L, 122L, 125L, 128L, 129L, 134L, 141L, 142L, 143L, 146L, 156L, 168L, 169L, 174L, 178L, 179L, 182L, 184L, 185L, 192L, 193L, 195L, 197L, 198L, 199L, 203L, 205L, 209L, 211L, 215L, 216L, 218L, 220L, 224L, 227L, 228L, 230L, 233L, 243L, 244L, 246L, 247L, 251L, 252L, 259L, 262L, 263L, 265L, 270L, 273L, 274L, 275L, 284L, 285L, 286L, 291L, 296L, 297L, 300L, 301L, 306L, 314L, 316L, 322L, 328L, 331L, 332L, 333L, 336L, 341L, 346L, 347L, 348L, 360L, 363L, 366L, 367L, 383L, 392L, 395L, 398L, 404L, 408L, 409L, 410L, 420L, 421L, 426L, 428L, 434L, 437L, 438L, 440L, 441L, 447L, 449L, 450L, 452L, 454L, 457L, 458L, 459L, 463L, 465L, 469L, 471L, 472L, 483L), class = "data.frame") On Fri, May 20, 2022 at 12:20 AM Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:> Not reproducible. Posted HTML. > > On May 19, 2022 2:30:58 PM PDT, Neha gupta <neha.bologna90 at gmail.com> > wrote: > >Why do I get the following error when my variable in the 'if statement' > has > >no missing values. > > > >I check with is.na(my variable) and it has no missing values > > > >Error in if (fraction <= 1) { : missing value where TRUE/FALSE needed > > > >Best regards > > > > [[alternative HTML version deleted]] > > > >______________________________________________ > >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > >stat.ethz.ch/mailman/listinfo/r-help > >PLEASE do read the posting guide > R-project.org/posting-guide.html > >and provide commented, minimal, self-contained, reproducible code. > > -- > Sent from my phone. Please excuse my brevity. >[[alternative HTML version deleted]]
Hi Strange, you say> prot <- ifelse(test$CE == '2', 1, 0) /// Error comes herebut with your data ifelse(test$CE == '2', 1, 0) [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [75] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [112] 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 the code runs smoothly without error. Cheers Petr> -----Original Message----- > From: R-help <r-help-bounces at r-project.org> On Behalf Of Neha gupta > Sent: Friday, May 20, 2022 10:16 AM > To: Jeff Newmiller <jdnewmil at dcn.davis.ca.us> > Cc: r-help mailing list <r-help at r-project.org> > Subject: Re: [R] missing values error in if statement > > I am sorry.. The code is here and data is provided at the end of this > email. > > data = readARFF("aho.arff") > > index= sample(1:nrow(data), 0.7*nrow(data)) > train= data[index,] > test= data[-index,] > > task = TaskClassif$new("data", backend = train, target = "isKilled") > learner= lrn("classif.randomForest", predict_type = "prob") > model= learner$train(task ) > > ///explainer is created to identify a bias in a particular feature i.e. CE > feature in this case > > explainer = explain_mlr3(model, > data = test[,-15], > y = as.numeric(test$isKilled)-1, > label="RF") > prot <- ifelse(test$CE == '2', 1, 0) /// Error comes here > privileged <- '1' > > > fc= fairness_check(explainer, > protected = prot, > privileged = privileged) > plot(fc) > > > ////////////////////////////////////////// my data is > > dput(test) > structure(list(DepthTree = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, > 2, 2, 2, 1, 1, 1, 1, 2, 1), NumSubclass = c(0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 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, 2, 2, > 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1), CE = c(2, 2, 2, 2, 2, > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2), Instability = c(0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0, 0, 0, 0, 0.667, 0.667), numCovered = c(0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 54, 54, > 54, 123, 54, 54, 39, 84, 54, 54, 15, 138, 189, 189, 189, 27, > 51, 33, 6, 27, 27, 150, 150, 150, 54, 150, 54, 54, 150, 117, > 51, 66, 60, 15, 15, 72, 12, 45, 255, 255, 129, 129, 129, 0, 129, > 0, 0, 6, 6, 6, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 12, > 12, 12, 18, 12, 12, 48, 12, 1557, 48, 12, 171, 0, 0, 0, 141, > 141, 45, 141, 18, 39), operator = structure(c(4L, 13L, 13L, 1L, > 4L, 9L, 12L, 4L, 11L, 4L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, 7L, 8L, > 8L, 6L, 7L, 8L, 4L, 1L, 2L, 3L, 4L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, > 11L, 12L, 12L, 4L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 6L, 9L, > 9L, 4L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 10L, 1L, 1L, 1L, 7L, 7L, > 8L, 8L, 8L, 8L, 8L, 13L, 13L, 7L, 8L, 8L, 9L, 8L, 8L, 8L, 8L, > 9L, 10L, 1L, 4L, 4L, 6L, 7L, 8L, 8L, 8L, 9L, 10L, 10L, 7L, 8L, > 8L, 10L, 11L, 11L, 7L, 8L, 4L, 8L, 9L, 10L, 10L, 4L, 10L, 7L, > 7L, 10L, 6L, 8L, 8L, 10L, 8L, 8L, 10L, 9L, 8L, 10L, 7L, 7L, 13L, > 2L, 2L, 2L, 8L, 8L, 8L, 8L, 8L, 11L, 10L, 10L, 13L, 13L, 8L, > 8L, 8L, 6L, 7L, 8L, 10L, 13L, 13L), .Label = c("T0", "T1", "T2", > "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "T11", "T12", > "T13", "T14", "T15"), class = "factor"), methodReturn = structure(c(2L, > 2L, 2L, 2L, 2L, 2L, 2L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, > 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, > 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, > 4L, 4L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 3L, 3L, 3L, 1L, 4L, > 4L, 4L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 4L, 4L, 4L, 4L, > 4L, 4L, 4L, 4L, 3L, 3L, 2L, 2L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 2L, > 2L), .Label = c("I", "V", "Z", "method", "D", "[D", "[[D", "J", > "[I", "C", "[J", "[C", "[S", "F", "[F", "[B", "S", "B", "[Z", > "[[S", "[[B", "[[Z"), class = "factor"), numTestsCover = c(16, > 16, 16, 15, 15, 16, 15, 4, 16, 16, 15, 16, 15, 15, 15, 15, 15, > 3, 3, 3, 2, 16, 11, 4, 16, 3, 16, 16, 16, 16, 16, 4, 16, 16, > 16, 4, 16, 16, 3, 3, 3, 2, 4, 3, 2, 1, 4, 1, 15, 16, 15, 2, 3, > 2, 3, 3, 2, 2, 2, 3, 4, 5, 5, 5, 4, 5, 5, 4, 4, 5, 5, 4, 4, 4, > 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 4, > 4, 4, 3, 4, 4, 4, 6, 6, 6, 0, 6, 0, 0, 2, 2, 2, 7, 0, 0, 0, 15, > 16, 16, 16, 15, 17, 17, 17, 15, 5, 4, 4, 4, 3, 4, 4, 3, 4, 16, > 16, 4, 17, 0, 0, 0, 5, 5, 3, 5, 2, 3), mutantAssert = c(55, 55, > 55, 55, 55, 55, 55, 13, 55, 55, 55, 55, 55, 55, 55, 55, 55, 9, > 9, 9, 9, 55, 41, 13, 55, 5, 55, 55, 55, 55, 55, 13, 55, 55, 55, > 13, 55, 55, 13, 13, 13, 8, 13, 13, 8, 4, 13, 4, 55, 55, 55, 9, > 9, 9, 9, 9, 9, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, > 9, 9, 9, 9, 9, 9, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, > 9, 9, 9, 6, 9, 9, 9, 14, 14, 14, 0, 14, 0, 0, 2, 2, 2, 15, 0, > 0, 0, 55, 58, 58, 55, 55, 58, 58, 58, 55, 9, 6, 6, 6, 6, 6, 6, > 6, 6, 55, 55, 13, 57, 0, 0, 0, 11, 11, 7, 11, 9, 9), classAssert = c(3, > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, > 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 3, 3, 3, 3, 3, 3, > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 1, 1, 1, 1, 3, 3, > 3, 3, 0, 0), isKilled = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, > 1L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, > 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L), .Label = c("yes", > "no"), class = "factor")), row.names = c(3L, 4L, 5L, 7L, 9L, > 17L, 20L, 21L, 26L, 28L, 32L, 33L, 40L, 43L, 45L, 49L, 54L, 62L, > 64L, 65L, 70L, 75L, 77L, 81L, 84L, 86L, 88L, 89L, 93L, 95L, 97L, > 99L, 101L, 102L, 106L, 111L, 112L, 113L, 118L, 122L, 125L, 128L, > 129L, 134L, 141L, 142L, 143L, 146L, 156L, 168L, 169L, 174L, 178L, > 179L, 182L, 184L, 185L, 192L, 193L, 195L, 197L, 198L, 199L, 203L, > 205L, 209L, 211L, 215L, 216L, 218L, 220L, 224L, 227L, 228L, 230L, > 233L, 243L, 244L, 246L, 247L, 251L, 252L, 259L, 262L, 263L, 265L, > 270L, 273L, 274L, 275L, 284L, 285L, 286L, 291L, 296L, 297L, 300L, > 301L, 306L, 314L, 316L, 322L, 328L, 331L, 332L, 333L, 336L, 341L, > 346L, 347L, 348L, 360L, 363L, 366L, 367L, 383L, 392L, 395L, 398L, > 404L, 408L, 409L, 410L, 420L, 421L, 426L, 428L, 434L, 437L, 438L, > 440L, 441L, 447L, 449L, 450L, 452L, 454L, 457L, 458L, 459L, 463L, > 465L, 469L, 471L, 472L, 483L), class = "data.frame") > > On Fri, May 20, 2022 at 12:20 AM Jeff Newmiller > <jdnewmil at dcn.davis.ca.us> > wrote: > > > Not reproducible. Posted HTML. > > > > On May 19, 2022 2:30:58 PM PDT, Neha gupta > <neha.bologna90 at gmail.com> > > wrote: > > >Why do I get the following error when my variable in the 'if statement' > > has > > >no missing values. > > > > > >I check with is.na(my variable) and it has no missing values > > > > > >Error in if (fraction <= 1) { : missing value where TRUE/FALSE needed > > > > > >Best regards > > > > > > [[alternative HTML version deleted]] > > > > > >______________________________________________ > > >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > >stat.ethz.ch/mailman/listinfo/r-help > > >PLEASE do read the posting guide > > R-project.org/posting-guide.html > > >and provide commented, minimal, self-contained, reproducible code. > > > > -- > > Sent from my phone. Please excuse my brevity. > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.
On Fri, 20 May 2022 10:16:05 +0200 Neha gupta <neha.bologna90 at gmail.com> wrote:> prot <- ifelse(test$CE == '2', 1, 0) /// Error comes hereI can't reproduce the error at this line with the data you have attached. Are you sure it's not happening elsewhere? What does traceback() say after the error? -- Best regards, Ivan
Actually I am not very sure where exactly the error raised but when I run the plot(fc) , it shows the error. I checked it online and people suggested that it may come with missing values in 'if' or 'while; statements etc. I do not know how your code works and mine not. Best regards On Fri, May 20, 2022 at 10:16 AM Neha gupta <neha.bologna90 at gmail.com> wrote:> I am sorry.. The code is here and data is provided at the end of this > email. > > data = readARFF("aho.arff") > > index= sample(1:nrow(data), 0.7*nrow(data)) > train= data[index,] > test= data[-index,] > > task = TaskClassif$new("data", backend = train, target = "isKilled") > learner= lrn("classif.randomForest", predict_type = "prob") > model= learner$train(task ) > > ///explainer is created to identify a bias in a particular feature i.e. CE > feature in this case > > explainer = explain_mlr3(model, > data = test[,-15], > y = as.numeric(test$isKilled)-1, > label="RF") > prot <- ifelse(test$CE == '2', 1, 0) /// Error comes here > privileged <- '1' > > > fc= fairness_check(explainer, > protected = prot, > privileged = privileged) > plot(fc) > > > ////////////////////////////////////////// my data is > > dput(test) > structure(list(DepthTree = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, > 2, 2, 2, 1, 1, 1, 1, 2, 1), NumSubclass = c(0, 0, 0, 0, 0, 0, >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2, 2, 2, 2, 2, > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, > 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1), CE = c(2, 2, 2, 2, 2, > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2), Instability = c(0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0, 0, 0, 0, 0.667, 0.667), numCovered = c(0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 54, 54, > 54, 123, 54, 54, 39, 84, 54, 54, 15, 138, 189, 189, 189, 27, > 51, 33, 6, 27, 27, 150, 150, 150, 54, 150, 54, 54, 150, 117, > 51, 66, 60, 15, 15, 72, 12, 45, 255, 255, 129, 129, 129, 0, 129, > 0, 0, 6, 6, 6, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 12, > 12, 12, 18, 12, 12, 48, 12, 1557, 48, 12, 171, 0, 0, 0, 141, > 141, 45, 141, 18, 39), operator = structure(c(4L, 13L, 13L, 1L, > 4L, 9L, 12L, 4L, 11L, 4L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, 7L, 8L, > 8L, 6L, 7L, 8L, 4L, 1L, 2L, 3L, 4L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, > 11L, 12L, 12L, 4L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 6L, 9L, > 9L, 4L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 10L, 1L, 1L, 1L, 7L, 7L, > 8L, 8L, 8L, 8L, 8L, 13L, 13L, 7L, 8L, 8L, 9L, 8L, 8L, 8L, 8L, > 9L, 10L, 1L, 4L, 4L, 6L, 7L, 8L, 8L, 8L, 9L, 10L, 10L, 7L, 8L, > 8L, 10L, 11L, 11L, 7L, 8L, 4L, 8L, 9L, 10L, 10L, 4L, 10L, 7L, > 7L, 10L, 6L, 8L, 8L, 10L, 8L, 8L, 10L, 9L, 8L, 10L, 7L, 7L, 13L, > 2L, 2L, 2L, 8L, 8L, 8L, 8L, 8L, 11L, 10L, 10L, 13L, 13L, 8L, > 8L, 8L, 6L, 7L, 8L, 10L, 13L, 13L), .Label = c("T0", "T1", "T2", > "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "T11", "T12", > "T13", "T14", "T15"), class = "factor"), methodReturn = structure(c(2L, > 2L, 2L, 2L, 2L, 2L, 2L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, > 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, > 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, > 4L, 4L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 3L, 3L, 3L, 1L, 4L, > 4L, 4L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 4L, 4L, 4L, 4L, > 4L, 4L, 4L, 4L, 3L, 3L, 2L, 2L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 2L, > 2L), .Label = c("I", "V", "Z", "method", "D", "[D", "[[D", "J", > "[I", "C", "[J", "[C", "[S", "F", "[F", "[B", "S", "B", "[Z", > "[[S", "[[B", "[[Z"), class = "factor"), numTestsCover = c(16, > 16, 16, 15, 15, 16, 15, 4, 16, 16, 15, 16, 15, 15, 15, 15, 15, > 3, 3, 3, 2, 16, 11, 4, 16, 3, 16, 16, 16, 16, 16, 4, 16, 16, > 16, 4, 16, 16, 3, 3, 3, 2, 4, 3, 2, 1, 4, 1, 15, 16, 15, 2, 3, > 2, 3, 3, 2, 2, 2, 3, 4, 5, 5, 5, 4, 5, 5, 4, 4, 5, 5, 4, 4, 4, > 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 4, > 4, 4, 3, 4, 4, 4, 6, 6, 6, 0, 6, 0, 0, 2, 2, 2, 7, 0, 0, 0, 15, > 16, 16, 16, 15, 17, 17, 17, 15, 5, 4, 4, 4, 3, 4, 4, 3, 4, 16, > 16, 4, 17, 0, 0, 0, 5, 5, 3, 5, 2, 3), mutantAssert = c(55, 55, > 55, 55, 55, 55, 55, 13, 55, 55, 55, 55, 55, 55, 55, 55, 55, 9, > 9, 9, 9, 55, 41, 13, 55, 5, 55, 55, 55, 55, 55, 13, 55, 55, 55, > 13, 55, 55, 13, 13, 13, 8, 13, 13, 8, 4, 13, 4, 55, 55, 55, 9, > 9, 9, 9, 9, 9, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, > 9, 9, 9, 9, 9, 9, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, > 9, 9, 9, 6, 9, 9, 9, 14, 14, 14, 0, 14, 0, 0, 2, 2, 2, 15, 0, > 0, 0, 55, 58, 58, 55, 55, 58, 58, 58, 55, 9, 6, 6, 6, 6, 6, 6, > 6, 6, 55, 55, 13, 57, 0, 0, 0, 11, 11, 7, 11, 9, 9), classAssert = c(3, > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 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, 43L, 45L, 49L, 54L, 62L, > 64L, 65L, 70L, 75L, 77L, 81L, 84L, 86L, 88L, 89L, 93L, 95L, 97L, > 99L, 101L, 102L, 106L, 111L, 112L, 113L, 118L, 122L, 125L, 128L, > 129L, 134L, 141L, 142L, 143L, 146L, 156L, 168L, 169L, 174L, 178L, > 179L, 182L, 184L, 185L, 192L, 193L, 195L, 197L, 198L, 199L, 203L, > 205L, 209L, 211L, 215L, 216L, 218L, 220L, 224L, 227L, 228L, 230L, > 233L, 243L, 244L, 246L, 247L, 251L, 252L, 259L, 262L, 263L, 265L, > 270L, 273L, 274L, 275L, 284L, 285L, 286L, 291L, 296L, 297L, 300L, > 301L, 306L, 314L, 316L, 322L, 328L, 331L, 332L, 333L, 336L, 341L, > 346L, 347L, 348L, 360L, 363L, 366L, 367L, 383L, 392L, 395L, 398L, > 404L, 408L, 409L, 410L, 420L, 421L, 426L, 428L, 434L, 437L, 438L, > 440L, 441L, 447L, 449L, 450L, 452L, 454L, 457L, 458L, 459L, 463L, > 465L, 469L, 471L, 472L, 483L), class = "data.frame") > > On Fri, May 20, 2022 at 12:20 AM Jeff Newmiller <jdnewmil at dcn.davis.ca.us> > wrote: > >> Not reproducible. Posted HTML. >> >> On May 19, 2022 2:30:58 PM PDT, Neha gupta <neha.bologna90 at gmail.com> >> wrote: >> >Why do I get the following error when my variable in the 'if statement' >> has >> >no missing values. >> > >> >I check with is.na(my variable) and it has no missing values >> > >> >Error in if (fraction <= 1) { : missing value where TRUE/FALSE needed >> > >> >Best regards >> > >> > [[alternative HTML version deleted]] >> > >> >______________________________________________ >> >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> >stat.ethz.ch/mailman/listinfo/r-help >> >PLEASE do read the posting guide >> R-project.org/posting-guide.html >> >and provide commented, minimal, self-contained, reproducible code. >> >> -- >> Sent from my phone. Please excuse my brevity. >> >[[alternative HTML version deleted]]
Hello, This is a frequent way of coding and a source for questions. ifelse(test$CE == '2', 1, 0) is equivalent to the much more performant as.integer(test$CE == '2') # or as.numeric If the code still runs with errors, then those errors came from elsewhere. Hope this helps, Rui Barradas ?s 09:16 de 20/05/2022, Neha gupta escreveu:> I am sorry.. The code is here and data is provided at the end of this > email. > > data = readARFF("aho.arff") > > index= sample(1:nrow(data), 0.7*nrow(data)) > train= data[index,] > test= data[-index,] > > task = TaskClassif$new("data", backend = train, target = "isKilled") > learner= lrn("classif.randomForest", predict_type = "prob") > model= learner$train(task ) > > ///explainer is created to identify a bias in a particular feature i.e. CE > feature in this case > > explainer = explain_mlr3(model, > data = test[,-15], > y = as.numeric(test$isKilled)-1, > label="RF") > prot <- ifelse(test$CE == '2', 1, 0) /// Error comes here > privileged <- '1' > > > fc= fairness_check(explainer, > protected = prot, > privileged = privileged) > plot(fc) > > > ////////////////////////////////////////// my data is > > dput(test) > structure(list(DepthTree = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, > 2, 2, 2, 1, 1, 1, 1, 2, 1), NumSubclass = c(0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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2, 2, 2, 2, 2, 2, 2, 2, > 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1), CE = c(2, 2, 2, 2, 2, > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2), Instability = c(0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0.667, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, > 0.667, 0.667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.667, 0.667, 0.667, > 0.667, 0.667, 0.667, 0.667, 0, 0, 0, 0, 0.667, 0.667), numCovered = c(0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 54, 54, > 54, 123, 54, 54, 39, 84, 54, 54, 15, 138, 189, 189, 189, 27, > 51, 33, 6, 27, 27, 150, 150, 150, 54, 150, 54, 54, 150, 117, > 51, 66, 60, 15, 15, 72, 12, 45, 255, 255, 129, 129, 129, 0, 129, > 0, 0, 6, 6, 6, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 12, > 12, 12, 18, 12, 12, 48, 12, 1557, 48, 12, 171, 0, 0, 0, 141, > 141, 45, 141, 18, 39), operator = structure(c(4L, 13L, 13L, 1L, > 4L, 9L, 12L, 4L, 11L, 4L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, 7L, 8L, > 8L, 6L, 7L, 8L, 4L, 1L, 2L, 3L, 4L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, > 11L, 12L, 12L, 4L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 6L, 9L, > 9L, 4L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 10L, 1L, 1L, 1L, 7L, 7L, > 8L, 8L, 8L, 8L, 8L, 13L, 13L, 7L, 8L, 8L, 9L, 8L, 8L, 8L, 8L, > 9L, 10L, 1L, 4L, 4L, 6L, 7L, 8L, 8L, 8L, 9L, 10L, 10L, 7L, 8L, > 8L, 10L, 11L, 11L, 7L, 8L, 4L, 8L, 9L, 10L, 10L, 4L, 10L, 7L, > 7L, 10L, 6L, 8L, 8L, 10L, 8L, 8L, 10L, 9L, 8L, 10L, 7L, 7L, 13L, > 2L, 2L, 2L, 8L, 8L, 8L, 8L, 8L, 11L, 10L, 10L, 13L, 13L, 8L, > 8L, 8L, 6L, 7L, 8L, 10L, 13L, 13L), .Label = c("T0", "T1", "T2", > "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "T11", "T12", > "T13", "T14", "T15"), class = "factor"), methodReturn = structure(c(2L, > 2L, 2L, 2L, 2L, 2L, 2L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, > 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, > 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, > 4L, 4L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 3L, 3L, 3L, 1L, 4L, > 4L, 4L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 4L, 4L, 4L, 4L, > 4L, 4L, 4L, 4L, 3L, 3L, 2L, 2L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 2L, > 2L), .Label = c("I", "V", "Z", "method", "D", "[D", "[[D", "J", > "[I", "C", "[J", "[C", "[S", "F", "[F", "[B", "S", "B", "[Z", > "[[S", "[[B", "[[Z"), class = "factor"), numTestsCover = c(16, > 16, 16, 15, 15, 16, 15, 4, 16, 16, 15, 16, 15, 15, 15, 15, 15, > 3, 3, 3, 2, 16, 11, 4, 16, 3, 16, 16, 16, 16, 16, 4, 16, 16, > 16, 4, 16, 16, 3, 3, 3, 2, 4, 3, 2, 1, 4, 1, 15, 16, 15, 2, 3, > 2, 3, 3, 2, 2, 2, 3, 4, 5, 5, 5, 4, 5, 5, 4, 4, 5, 5, 4, 4, 4, > 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 4, > 4, 4, 3, 4, 4, 4, 6, 6, 6, 0, 6, 0, 0, 2, 2, 2, 7, 0, 0, 0, 15, > 16, 16, 16, 15, 17, 17, 17, 15, 5, 4, 4, 4, 3, 4, 4, 3, 4, 16, > 16, 4, 17, 0, 0, 0, 5, 5, 3, 5, 2, 3), mutantAssert = c(55, 55, > 55, 55, 55, 55, 55, 13, 55, 55, 55, 55, 55, 55, 55, 55, 55, 9, > 9, 9, 9, 55, 41, 13, 55, 5, 55, 55, 55, 55, 55, 13, 55, 55, 55, > 13, 55, 55, 13, 13, 13, 8, 13, 13, 8, 4, 13, 4, 55, 55, 55, 9, > 9, 9, 9, 9, 9, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, > 9, 9, 9, 9, 9, 9, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, > 9, 9, 9, 6, 9, 9, 9, 14, 14, 14, 0, 14, 0, 0, 2, 2, 2, 15, 0, > 0, 0, 55, 58, 58, 55, 55, 58, 58, 58, 55, 9, 6, 6, 6, 6, 6, 6, > 6, 6, 55, 55, 13, 57, 0, 0, 0, 11, 11, 7, 11, 9, 9), classAssert = c(3, > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, > 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 3, 3, 3, 3, 3, 3, > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 1, 1, 1, 1, 3, 3, > 3, 3, 0, 0), isKilled = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, > 1L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, > 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, > 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L), .Label = c("yes", > "no"), class = "factor")), row.names = c(3L, 4L, 5L, 7L, 9L, > 17L, 20L, 21L, 26L, 28L, 32L, 33L, 40L, 43L, 45L, 49L, 54L, 62L, > 64L, 65L, 70L, 75L, 77L, 81L, 84L, 86L, 88L, 89L, 93L, 95L, 97L, > 99L, 101L, 102L, 106L, 111L, 112L, 113L, 118L, 122L, 125L, 128L, > 129L, 134L, 141L, 142L, 143L, 146L, 156L, 168L, 169L, 174L, 178L, > 179L, 182L, 184L, 185L, 192L, 193L, 195L, 197L, 198L, 199L, 203L, > 205L, 209L, 211L, 215L, 216L, 218L, 220L, 224L, 227L, 228L, 230L, > 233L, 243L, 244L, 246L, 247L, 251L, 252L, 259L, 262L, 263L, 265L, > 270L, 273L, 274L, 275L, 284L, 285L, 286L, 291L, 296L, 297L, 300L, > 301L, 306L, 314L, 316L, 322L, 328L, 331L, 332L, 333L, 336L, 341L, > 346L, 347L, 348L, 360L, 363L, 366L, 367L, 383L, 392L, 395L, 398L, > 404L, 408L, 409L, 410L, 420L, 421L, 426L, 428L, 434L, 437L, 438L, > 440L, 441L, 447L, 449L, 450L, 452L, 454L, 457L, 458L, 459L, 463L, > 465L, 469L, 471L, 472L, 483L), class = "data.frame") > > On Fri, May 20, 2022 at 12:20 AM Jeff Newmiller <jdnewmil at dcn.davis.ca.us> > wrote: > >> Not reproducible. Posted HTML. >> >> On May 19, 2022 2:30:58 PM PDT, Neha gupta <neha.bologna90 at gmail.com> >> wrote: >>> Why do I get the following error when my variable in the 'if statement' >> has >>> no missing values. >>> >>> I check with is.na(my variable) and it has no missing values >>> >>> Error in if (fraction <= 1) { : missing value where TRUE/FALSE needed >>> >>> Best regards >>> >>> [[alternative HTML version deleted]] >>> >>> ______________________________________________ >>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >> R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >> >> -- >> Sent from my phone. Please excuse my brevity. >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Neha, Others have not reproduced your issue. What you are sharing does not even?slightly resemble your first post as your code does NOT directly have the?"if" statement you asked about. The code you share has no variable called"fraction" visible. From your later messages, it sounds like your real?error message comes from within the hidden recesses of the plot()?command. So it may internally be doing things that end up generating an?NA or other anomalies. Just as feedback, the code you shared does not seem complete.? You?clearly have some packages loaded you do not mention so they need to?be specified in order for readARFF() to be called and of course we need a?data file. More is missing.? Skipping forward, you did supply a way to reconstitute the variable "test" afterwards soit is possible to examine your code somewhat mid-way. You say this broke: prot <- ifelse(test$CE == '2', 1, 0)? ? ? /// Error comes here Well, in R "///" does not make a comment. You use a "#" and when you do that line runs and?makes a vector with 68 instances of 0 and 78 instances of 1. This corresponds fine with the?contents of test$CE But not having explicit? knowledge of what I think are several packages, I see no reason?to continue trying. You are trying to explain but not yet giving the right amount and type? of info.If we need to guess your package is?mlr3extralearners then your importing the library into?your code may work for you but then don't ask others who start a new R session to help.? As others have mentioned, a good representative example is one where you start a fresh R?session and it runs properly enough to show the error. You may learn that what you sent could?be improved. -----Original Message----- From: Neha gupta <neha.bologna90 at gmail.com> To: Jeff Newmiller <jdnewmil at dcn.davis.ca.us> Cc: r-help mailing list <r-help at r-project.org> Sent: Fri, May 20, 2022 4:16 am Subject: Re: [R] missing values error in if statement I am sorry.. The code is here and data is provided at the end of this email. data = readARFF("aho.arff") index= sample(1:nrow(data), 0.7*nrow(data)) train= data[index,] test= data[-index,] task = TaskClassif$new("data", backend = train, target = "isKilled") learner= lrn("classif.randomForest", predict_type = "prob") model= learner$train(task ) ///explainer is created to identify a bias in a particular feature i.e. CE feature in this case explainer = explain_mlr3(model, ? ? ? ? ? ? ? ? ? ? ? ? data = test[,-15], ? ? ? ? ? ? ? ? ? ? ? ? y = as.numeric(test$isKilled)-1, ? ? ? ? ? ? ? ? ? ? ? ? label="RF") prot <- ifelse(test$CE == '2', 1, 0)? ? ? /// Error comes here privileged <- '1' fc= fairness_check(explainer, ? ? ? ? ? ? ? ? ? ? ? ? ? protected = prot, ? ? ? ? ? ? ? ? ? privileged = privileged) plot(fc) ////////////////////////////////////////// my data is dput(test) structure(list(D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, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2, 2), Instability = c(0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0, 0, 0, 0, 0.667, 0.667), numCovered = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 54, 54, 54, 123, 54, 54, 39, 84, 54, 54, 15, 138, 189, 189, 189, 27, 51, 33, 6, 27, 27, 150, 150, 150, 54, 150, 54, 54, 150, 117, 51, 66, 60, 15, 15, 72, 12, 45, 255, 255, 129, 129, 129, 0, 129, 0, 0, 6, 6, 6, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 12, 12, 12, 18, 12, 12, 48, 12, 1557, 48, 12, 171, 0, 0, 0, 141, 141, 45, 141, 18, 39), operator = structure(c(4L, 13L, 13L, 1L, 4L, 9L, 12L, 4L, 11L, 4L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, 7L, 8L, 8L, 6L, 7L, 8L, 4L, 1L, 2L, 3L, 4L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, 11L, 12L, 12L, 4L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 6L, 9L, 9L, 4L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 10L, 1L, 1L, 1L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 13L, 13L, 7L, 8L, 8L, 9L, 8L, 8L, 8L, 8L, 9L, 10L, 1L, 4L, 4L, 6L, 7L, 8L, 8L, 8L, 9L, 10L, 10L, 7L, 8L, 8L, 10L, 11L, 11L, 7L, 8L, 4L, 8L, 9L, 10L, 10L, 4L, 10L, 7L, 7L, 10L, 6L, 8L, 8L, 10L, 8L, 8L, 10L, 9L, 8L, 10L, 7L, 7L, 13L, 2L, 2L, 2L, 8L, 8L, 8L, 8L, 8L, 11L, 10L, 10L, 13L, 13L, 8L, 8L, 8L, 6L, 7L, 8L, 10L, 13L, 13L), .Label = c("T0", "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "T11", "T12", "T13", "T14", "T15"), class = "factor"), methodReturn = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 3L, 3L, 3L, 1L, 4L, 4L, 4L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 2L, 2L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 2L, 2L), .Label = c("I", "V", "Z", "method", "D", "[D", "[[D", "J", "[I", "C", "[J", "[C", "[S", "F", "[F", "[B", "S", "B", "[Z", "[[S", "[[B", "[[Z"), class = "factor"), numTestsCover = c(16, 16, 16, 15, 15, 16, 15, 4, 16, 16, 15, 16, 15, 15, 15, 15, 15, 3, 3, 3, 2, 16, 11, 4, 16, 3, 16, 16, 16, 16, 16, 4, 16, 16, 16, 4, 16, 16, 3, 3, 3, 2, 4, 3, 2, 1, 4, 1, 15, 16, 15, 2, 3, 2, 3, 3, 2, 2, 2, 3, 4, 5, 5, 5, 4, 5, 5, 4, 4, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 6, 6, 6, 0, 6, 0, 0, 2, 2, 2, 7, 0, 0, 0, 15, 16, 16, 16, 15, 17, 17, 17, 15, 5, 4, 4, 4, 3, 4, 4, 3, 4, 16, 16, 4, 17, 0, 0, 0, 5, 5, 3, 5, 2, 3), mutantAssert = c(55, 55, 55, 55, 55, 55, 55, 13, 55, 55, 55, 55, 55, 55, 55, 55, 55, 9, 9, 9, 9, 55, 41, 13, 55, 5, 55, 55, 55, 55, 55, 13, 55, 55, 55, 13, 55, 55, 13, 13, 13, 8, 13, 13, 8, 4, 13, 4, 55, 55, 55, 9, 9, 9, 9, 9, 9, 8, 8, 9,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1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L), .Label = c("yes", "no"), class = "factor")), row.names = c(3L, 4L, 5L, 7L, 9L, 17L, 20L, 21L, 26L, 28L, 32L, 33L, 40L, 43L, 45L, 49L, 54L, 62L, 64L, 65L, 70L, 75L, 77L, 81L, 84L, 86L, 88L, 89L, 93L, 95L, 97L, 99L, 101L, 102L, 106L, 111L, 112L, 113L, 118L, 122L, 125L, 128L, 129L, 134L, 141L, 142L, 143L, 146L, 156L, 168L, 169L, 174L, 178L, 179L, 182L, 184L, 185L, 192L, 193L, 195L, 197L, 198L, 199L, 203L, 205L, 209L, 211L, 215L, 216L, 218L, 220L, 224L, 227L, 228L, 230L, 233L, 243L, 244L, 246L, 247L, 251L, 252L, 259L, 262L, 263L, 265L, 270L, 273L, 274L, 275L, 284L, 285L, 286L, 291L, 296L, 297L, 300L, 301L, 306L, 314L, 316L, 322L, 328L, 331L, 332L, 333L, 336L, 341L, 346L, 347L, 348L, 360L, 363L, 366L, 367L, 383L, 392L, 395L, 398L, 404L, 408L, 409L, 410L, 420L, 421L, 426L, 428L, 434L, 437L, 438L, 440L, 441L, 447L, 449L, 450L, 452L, 454L, 457L, 458L, 459L, 463L, 465L, 469L, 471L, 472L, 483L), class = "data.frame") On Fri, May 20, 2022 at 12:20 AM Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:> Not reproducible. Posted HTML. > > On May 19, 2022 2:30:58 PM PDT, Neha gupta <neha.bologna90 at gmail.com> > wrote: > >Why do I get the following error when my variable in the 'if statement' > has > >no missing values. > > > >I check with is.na(my variable) and it has no missing values > > > >Error in if (fraction <= 1) { : missing value where TRUE/FALSE needed > > > >Best regards > > > >? ? ? [[alternative HTML version deleted]] > > > >______________________________________________ > >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > >stat.ethz.ch/mailman/listinfo/r-help > >PLEASE do read the posting guide > R-project.org/posting-guide.html > >and provide commented, minimal, self-contained, reproducible code. > > -- > Sent from my phone. Please excuse my brevity. >??? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]