[R] Error in if (fraction <= 1) { : missing value where TRUE/FALSE needed

javed khan j@vedbtk111 @end|ng |rom gm@||@com
Thu Jan 27 19:31:07 CET 2022


Ok thank you :)

On Thu, Jan 27, 2022 at 7:24 PM Bert Gunter <bgunter.4567 using gmail.com> wrote:

> No no! As Petr said, your original ifelse() is fine. I was just
> pointing out that using just the logical vector
> test$operator == 'T13'
> instead of the numeric ifelse() would serve just as well in any
> reasonable example I could think of. If you don't understand this,
> just **ignore** my comment.
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
> On Thu, Jan 27, 2022 at 10:15 AM javed khan <javedbtk111 using gmail.com> wrote:
> >
> > Thank you Bert Gunter
> >
> > Do you mean I should do something like this:
> >
> > prot <- (as.numeric(ifelse(test$operator == 'T13', 1, 0))
> >
> >
> >
> >
> > On Thu, Jan 27, 2022 at 4:44 PM Bert Gunter <bgunter.4567 using gmail.com>
> wrote:
> >>
> >> This will not help solve the issue, but perhaps it is worth pointing
> >> out that the idiom,
> >> prot <- ifelse(test$operator == 'T13', 1, 0)
> >> is perhaps more simply coded as
> >> prot <- test$operator == 'T13'
> >>
> >> This will give a logical, TRUE/FALSE, instead of 1/0, but I doubt that
> >> a numeric is needed anyway. However, as.numeric() would of course do
> >> such a conversion, in which case the original ifelse might as well be
> >> used.
> >>
> >> Bert Gunter
> >>
> >> "The trouble with having an open mind is that people keep coming along
> >> and sticking things into it."
> >> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> >>
> >> On Wed, Jan 26, 2022 at 11:39 PM PIKAL Petr <petr.pikal using precheza.cz>
> wrote:
> >> >
> >> > Hi
> >> >
> >> > Actually you did not. Your original question was:
> >> >
> >> > > Error in if (fraction <= 1) { : missing value where TRUE/FALSE
> needed
> >> > > I used this:
> >> > > var <- ifelse(test$operator == 'T14', 1, 0)
> >> > > operator has several values like T1, T3, T7, T15, T31, T37
> >> > > For some values like T3, T7 it works fine but for majority of values
> >> > > it gives error.
> >> > > When I use: is.na(ts$operator), it shows all false values so no
> NAs.
> >> >
> >> > Only now we could inspect your whole code and it was already pointed
> that the
> >> > error does not originate from ifelse.
> >> >
> >> > With the same data and ifelse code I did not get any error.
> >> >
> >> > 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,
> >> > <snip>
> >> >
> >> > > str(test)
> >> > 'data.frame':   146 obs. of  15 variables:
> >> >  $ DepthTree    : num  1 1 1 1 1 1 1 1 1 1 ...
> >> >  <snip>
> >> > $ numCovered   : num  0 0 0 0 0 0 0 0 0 0 ...
> >> >  $ operator     : Factor w/ 16 levels "T0","T1","T2",..: 4 4 7 8 8 8
> 11 4 10 7
> >> > ...
> >> >  $ methodReturn : Factor w/ 22 levels "I","V","Z","method",..: 2 2 2
> 2 2 2 2 4
> >> > 4 2 ...
> >> >  $ numTestsCover: num  16 15 15 16 15 15 15 4 4 16 ...
> >> >  $ mutantAssert : num  55 55 55 55 55 55 55 13 13 55 ...
> >> >  $ classAssert  : num  3 3 3 3 3 3 3 3 3 3 ...
> >> >  $ isKilled     : Factor w/ 2 levels "yes","no": 2 2 2 2 2 2 2 2 2 2
> ...
> >> > >
> >> > prot <- ifelse(test$operator == 'T13', 1, 0)
> >> >
> >> > the most probable source of the error is
> >> >
> >> > fc= fairness_check(explainer,
> >> >                           protected = prot,
> >> >                    privileged = privileged)
> >> >
> >> > so you should check explainer and privileged
> >> >
> >> > Cheers
> >> > Petr
> >> >
> >> > From: javed khan <javedbtk111 using gmail.com>
> >> > Sent: Wednesday, January 26, 2022 3:45 PM
> >> > To: PIKAL Petr <petr.pikal using precheza.cz>
> >> > Cc: R-help <r-help using r-project.org>
> >> > Subject: Re: [R] Error in if (fraction <= 1) { : missing value where
> >> > TRUE/FALSE needed
> >> >
> >> > Hi Pikal, why would I hide something? I provided just a code where
> error is.
> >> >
> >> > Full code is:
> >> >
> >> > 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.gbm", predict_type = "prob")
> >> >
> >> > model= learner$train(task )
> >> >
> >> > explainer = explain_mlr3(model,
> >> >                          data = test[,-15],
> >> >                          y = as.numeric(test$isKilled)-1,
> >> >                          label="GBM")
> >> >
> >> > prot <- ifelse(test$operator == 'T13', 1, 0)
> >> > privileged <- '1'
> >> >
> >> > fc= fairness_check(explainer,
> >> >                           protected = prot,
> >> >                    privileged = privileged)
> >> > plot(fc)
> >> >
> >> >
> >> > And my data is the following:
> >> >
> >> > str(test)
> >> > 'data.frame': 146 obs. of  15 variables:
> >> >  $ DepthTree    : num  1 1 1 1 1 1 1 1 1 1 ...
> >> >  $ NumSubclass  : num  0 0 0 0 0 0 0 0 0 0 ...
> >> >  $ McCabe       : num  1 3 3 3 3 3 3 1 1 2 ...
> >> >  $ LOC          : num  3 10 10 10 10 10 10 4 4 5 ...
> >> >  $ DepthNested  : num  1 2 2 2 2 2 2 1 1 2 ...
> >> >  $ CA           : num  1 1 1 1 1 1 1 1 1 1 ...
> >> >  $ CE           : num  2 2 2 2 2 2 2 2 2 2 ...
> >> >  $ Instability  : num  0.667 0.667 0.667 0.667 0.667 0.667 0.667
> 0.667 0.667
> >> > 0.667 ...
> >> >  $ numCovered   : num  0 0 0 0 0 0 0 0 0 0 ...
> >> >  $ operator     : Factor w/ 16 levels "T0","T1","T2",..: 4 4 7 8 8 8
> 11 4 10 7
> >> > ...
> >> >  $ methodReturn : Factor w/ 22 levels "I","V","Z","method",..: 2 2 2
> 2 2 2 2 4
> >> > 4 2 ...
> >> >  $ numTestsCover: num  16 15 15 16 15 15 15 4 4 16 ...
> >> >  $ mutantAssert : num  55 55 55 55 55 55 55 13 13 55 ...
> >> >  $ classAssert  : num  3 3 3 3 3 3 3 3 3 3 ...
> >> >  $ isKilled     : Factor w/ 2 levels "yes","no": 2 2 2 2 2 2 2 2 2 2
> ...
> >> > > 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, 1,
> >> > 1, 1, 2, 2, 1, 2, 1, 1, 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, 0, 0,
> >> > 0, 0, 0, 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, 0, 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), McCabe = c(1, 3, 3,
> >> > 3, 3, 3, 3, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 1, 1, 1, 2,
> >> > 2, 2, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 3, 3,
> >> > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2,
> >> > 2, 5, 5, 5, 5, 5, 5, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 3, 3, 3,
> >> > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> >> > 2, 2, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 2, 2,
> >> > 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1), LOC = c(3,
> >> > 10, 10, 10, 10, 10, 10, 4, 4, 5, 22, 22, 22, 22, 22, 22, 22,
> >> > 22, 3, 3, 3, 3, 3, 8, 8, 8, 4, 23, 23, 23, 23, 23, 23, 23, 23,
> >> > 23, 23, 16, 16, 16, 16, 16, 16, 8, 8, 8, 8, 8, 8, 16, 16, 16,
> >> > 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, 20, 7, 7, 7, 7, 18, 18,
> >> > 18, 18, 18, 18, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 6, 15,
> >> > 15, 15, 15, 15, 15, 15, 15, 15, 9, 9, 9, 9, 9, 9, 4, 4, 3, 3,
> >> > 3, 3, 3, 4, 4, 6, 6, 5, 5, 5, 8, 8, 8, 3, 3, 3, 3, 3, 3, 7, 3,
> >> > 3, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, 3, 3, 3, 3, 4, 4, 8,
> >> > 4, 4, 4, 3), DepthNested = c(1, 2, 2, 2, 2, 2, 2, 1, 1, 2, 4,
> >> > 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 2, 2, 2, 1, 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, 1,
> >> > 3, 3, 3, 3, 3, 3, 3, 3, 3, 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,
> >> > 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1,
> >> > 1, 1, 1, 1, 2, 1, 1, 1, 1), CA = 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, 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, 1, 1, 1, 1, 1, 1, 1, 1,
> >> > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
> >> > 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> >> > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0,
> >> > 0, 0, 2, 2, 2, 2, 2, 2, 0, 2, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> >> > 0, 0, 0, 0, 0, 0, 0, 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.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.667, 0.667, 0.667, 0.667, 0.667, 0.667, 0, 0.667, 0, 0,
> >> > 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,
> >> > 150, 54, 54, 123, 54, 54, 123, 54, 189, 189, 189, 138, 33, 18,
> >> > 27, 27, 18, 27, 15, 54, 54, 150, 150, 54, 150, 150, 54, 150,
> >> > 66, 60, 12, 60, 15, 45, 72, 12, 12, 45, 255, 255, 255, 255, 129,
> >> > 129, 0, 0, 6, 6, 6, 6, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> >> > 0, 0, 0, 0, 0, 0, 0, 0, 15, 21, 12, 12, 12, 12, 12, 12, 12, 12,
> >> > 48, 1557, 9, 12, 0, 0, 141, 0, 21, 21, 21), operator = structure(c(4L,
> >> > 4L, 7L, 8L, 8L, 8L, 11L, 4L, 10L, 7L, 4L, 7L, 8L, 8L, 8L, 9L,
> >> > 9L, 11L, 7L, 8L, 2L, 8L, 8L, 7L, 8L, 10L, 11L, 1L, 2L, 2L, 4L,
> >> > 8L, 8L, 8L, 8L, 10L, 12L, 4L, 6L, 6L, 8L, 8L, 8L, 7L, 7L, 8L,
> >> > 8L, 9L, 9L, 1L, 4L, 6L, 8L, 8L, 8L, 1L, 1L, 7L, 7L, 7L, 8L, 8L,
> >> > 13L, 7L, 8L, 9L, 9L, 1L, 1L, 2L, 7L, 8L, 10L, 10L, 4L, 7L, 7L,
> >> > 7L, 8L, 8L, 8L, 9L, 9L, 10L, 1L, 8L, 8L, 8L, 8L, 10L, 11L, 11L,
> >> > 11L, 6L, 7L, 8L, 9L, 9L, 10L, 6L, 10L, 1L, 4L, 7L, 10L, 6L, 7L,
> >> > 13L, 7L, 13L, 7L, 8L, 9L, 4L, 6L, 9L, 8L, 10L, 8L, 10L, 8L, 10L,
> >> > 9L, 8L, 10L, 13L, 10L, 2L, 7L, 7L, 8L, 8L, 9L, 11L, 11L, 10L,
> >> > 10L, 13L, 13L, 8L, 8L, 9L, 4L, 6L, 10L, 10L), .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, 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, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> >> > 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> >> > 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> >> > 1L, 1L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L,
> >> > 3L, 3L, 1L, 1L, 3L, 3L, 3L, 3L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> >> > 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 4L, 4L, 4L,
> >> > 4L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 2L, 2L, 4L, 4L, 1L, 3L, 1L, 1L,
> >> > 4L), .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,
> >> > 15, 15, 16, 15, 15, 15, 4, 4, 16, 16, 16, 15, 15, 15, 16, 16,
> >> > 15, 3, 3, 2, 2, 2, 16, 11, 16, 4, 16, 16, 3, 16, 16, 4, 16, 16,
> >> > 16, 16, 2, 3, 2, 1, 4, 1, 16, 15, 16, 15, 16, 16, 2, 2, 2, 3,
> >> > 2, 2, 4, 5, 5, 4, 5, 5, 4, 5, 4, 4, 4, 4, 4, 3, 4, 4, 3, 4, 4,
> >> > 5, 5, 4, 4, 5, 4, 4, 5, 4, 4, 4, 3, 4, 4, 4, 4, 3, 3, 4, 4, 4,
> >> > 4, 4, 6, 6, 0, 0, 2, 2, 2, 2, 7, 17, 17, 15, 15, 15, 15, 15,
> >> > 16, 16, 16, 16, 15, 16, 16, 15, 17, 17, 16, 16, 5, 4, 4, 4, 4,
> >> > 4, 4, 4, 4, 4, 16, 16, 3, 4, 0, 0, 5, 0, 4, 4, 1), mutantAssert =
> c(55,
> >> > 55, 55, 55, 55, 55, 55, 13, 13, 55, 55, 55, 55, 55, 55, 55, 55,
> >> > 55, 9, 9, 9, 9, 9, 55, 41, 55, 13, 55, 55, 5, 55, 55, 13, 55,
> >> > 55, 55, 55, 8, 13, 8, 4, 13, 4, 55, 55, 55, 55, 55, 55, 9, 9,
> >> > 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 9, 9, 6,
> >> > 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 9, 9, 9, 9, 6, 6, 9,
> >> > 9, 9, 9, 9, 14, 14, 0, 0, 2, 2, 2, 2, 15, 58, 58, 55, 55, 55,
> >> > 55, 55, 58, 58, 58, 55, 55, 55, 55, 55, 58, 58, 58, 58, 9, 9,
> >> > 6, 6, 6, 6, 6, 6, 6, 6, 55, 55, 5, 13, 0, 0, 11, 0, 9, 9, 8),
> >> >     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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, 1, 1, 3, 0,
> >> >     3, 3, 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, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L,
> >> >     1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L,
> >> >     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L,
> >> >     1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 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, 2L, 1L, 1L, 1L, 1L, 2L, 2L,
> >> >     1L, 2L, 1L, 1L, 1L), .Label = c("yes", "no"), class = "factor")),
> >> > row.names = c(3L,
> >> > 9L, 12L, 13L, 14L, 15L, 19L, 21L, 22L, 24L, 28L, 29L, 39L, 44L,
> >> > 46L, 51L, 52L, 57L, 62L, 63L, 68L, 71L, 73L, 75L, 77L, 80L, 83L,
> >> > 84L, 85L, 86L, 90L, 95L, 100L, 102L, 103L, 108L, 112L, 120L,
> >> > 122L, 123L, 142L, 143L, 146L, 158L, 159L, 160L, 163L, 167L, 168L,
> >> > 170L, 174L, 176L, 183L, 186L, 192L, 196L, 199L, 203L, 205L, 206L,
> >> > 208L, 214L, 221L, 226L, 229L, 233L, 234L, 235L, 236L, 237L, 238L,
> >> > 249L, 252L, 255L, 260L, 267L, 270L, 271L, 273L, 275L, 276L, 277L,
> >> > 278L, 286L, 288L, 293L, 295L, 297L, 298L, 300L, 301L, 302L, 306L,
> >> > 312L, 313L, 316L, 317L, 331L, 333L, 338L, 341L, 342L, 344L, 346L,
> >> > 348L, 359L, 370L, 375L, 378L, 381L, 382L, 383L, 386L, 389L, 390L,
> >> > 394L, 397L, 400L, 402L, 403L, 404L, 408L, 415L, 418L, 419L, 423L,
> >> > 425L, 426L, 429L, 431L, 432L, 433L, 444L, 446L, 447L, 448L, 449L,
> >> > 451L, 452L, 457L, 458L, 470L, 474L, 476L, 479L, 484L), class =
> "data.frame")
> >> >
> >> >
> >> >
> >> >
> >> > On Wed, Jan 26, 2022 at 3:29 PM PIKAL Petr <mailto:
> petr.pikal using precheza.cz>
> >> > wrote:
> >> > Hi
> >> >
> >> > It seems that you are hiding what you really do.
> >> >
> >> > This
> >> > > options(error = NULL)
> >> > works fine without any error. So please If you want some reasonable
> answer
> >> > post question with data and code which is causing the error.
> >> >
> >> > My wild guess is that you have some objects in your environment and
> you do
> >> > not know that they are used in you commands. Try to start fresh R
> session
> >> > and try to inspect your environment with
> >> >
> >> > ls()
> >> >
> >> > Cheers
> >> > Petr
> >> >
> >> > > -----Original Message-----
> >> > > From: R-help <mailto:r-help-bounces using r-project.org> On Behalf Of
> javed khan
> >> > > Sent: Wednesday, January 26, 2022 3:05 PM
> >> > > To: Ivan Krylov <mailto:krylov.r00t using gmail.com>
> >> > > Cc: R-help <mailto:r-help using r-project.org>
> >> > > Subject: Re: [R] Error in if (fraction <= 1) { : missing value where
> >> > TRUE/FALSE
> >> > > needed
> >> > >
> >> > > Ivan, thanks
> >> > >
> >> > > When I use options(error = NULL)
> >> > >
> >> > > it says: Error during wrapup: missing value where TRUE/FALSE needed
> >> > > Error: no more error handlers available (recursive errors?);
> invoking
> >> > 'abort'
> >> > > restart
> >> > >
> >> > > With traceback(), I get
> >> > >
> >> > > 4: readable_number(max_value - min_value, FALSE)
> >> > > 3: get_nice_ticks(lower_bound, upper_bound)
> >> > >
> >> > > On Wed, Jan 26, 2022 at 2:53 PM Ivan Krylov <mailto:
> krylov.r00t using gmail.com>
> >> > > wrote:
> >> > >
> >> > > > On Wed, 26 Jan 2022 14:47:16 +0100
> >> > > > javed khan <mailto:javedbtk111 using gmail.com> wrote:
> >> > > >
> >> > > > > Error in if (fraction <= 1) { : missing value where TRUE/FALSE
> >> > > > > needed
> >> > > >
> >> > > > > var <- ifelse(test$operator == 'T14', 1, 0)
> >> > > >
> >> > > > The error must be in a place different from your test$operator
> >> > > > comparison. Have you tried traceback() to get the call stack
> leading
> >> > > > to the error? Or options(error = recover) to land in a debugger
> >> > > > session the moment an uncaught error happens? (Use options(error =
> >> > > > NULL) to go back to the default behaviour.)
> >> > > >
> >> > > > Unrelated: var <- test$operator == 'T14' will also give you an
> >> > > > equivalent logical vector with a bit less work.
> >> > > >
> >> > > > --
> >> > > > Best regards,
> >> > > > Ivan
> >> > > >
> >> > >
> >> > >       [[alternative HTML version deleted]]
> >> > >
> >> > > ______________________________________________
> >> > > mailto:R-help using r-project.org mailing list -- To UNSUBSCRIBE and
> more, see
> >> > > https://stat.ethz.ch/mailman/listinfo/r-help
> >> > > PLEASE do read the posting guide
> >> > http://www.R-project.org/posting-guide.html
> >> > > and provide commented, minimal, self-contained, reproducible code.
> >> > ______________________________________________
> >> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> > https://stat.ethz.ch/mailman/listinfo/r-help
> >> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> >> > and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list