[R] Error in if (fraction <= 1) { : missing value where TRUE/FALSE needed
javed khan
j@vedbtk111 @end|ng |rom gm@||@com
Wed Jan 26 15:08:48 CET 2022
With str(test), I get
data.frame': 9879 obs. of 15 variables:
$ DepthTree : num 3 3 3 3 3 3 3 3 3 3 ...
$ NumSubclass : num 0 0 0 0 0 0 0 0 0 0 ...
$ McCabe : num 1 1 1 1 1 1 1 1 1 1 ...
$ LOC : num 9 16 16 16 16 6 6 8 8 8 ...
$ DepthNested : num 1 1 1 1 1 1 1 1 1 1 ...
$ CA : num 164 164 164 164 164 164 164 164 164 164 ...
$ CE : num 31 31 31 31 31 31 31 31 31 31 ...
$ Instability : num 0.159 0.159 0.159 0.159 0.159 0.159 0.159 0.159
0.159 0.159 ...
$ numCovered : num 132 2516 2516 2516 2516 ...
$ operator : Factor w/ 16 levels "T0","T1","T2",..: 8 16 8 8 8 8 8 16
4 4 ...
$ methodReturn : Factor w/ 22 levels "I","V","Z","method",..: 2 2 2 2 2 2
2 2 2 2 ...
$ numTestsCover: num 0 0 0 0 0 0 0 0 0 0 ...
$ mutantAssert : num 0 0 0 0 0 0 0 0 0 0 ...
$ classAssert : num 47 47 47 47 47 47 47 47 47 47 ...
$ isKilled : Factor w/ 2 levels "yes","no": 2 1 1 1 1 1 1 1 1 1 ...
On Wed, Jan 26, 2022 at 3:01 PM PIKAL Petr <petr.pikal using precheza.cz> wrote:
> Hi
>
> Do not post in HTML, please.
> Try to show your real data - use str(test), or preferably dput(test). If
> test is big, use only fraction of it
> The problem must be probably in your data.
>
> x <- sample(1:20, 100, replace=T)
> fake <- paste("T", x, sep="")
> ifelse(fake=="T14", 1,0)
> [1] 0 0 0 0 0 0 0 0 0 0 0 0 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
> [38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 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 1 0
>
> head(fake)
> [1] "T7" "T9" "T3" "T9" "T12" "T9"
> > str(fake)
> chr [1:100] "T7" "T9" "T3" "T9" "T12" "T9" "T19" "T19" "T12" "T2" "T17"
> ...
> >
> Cheers
> Petr
>
>
> > -----Original Message-----
> > From: R-help <r-help-bounces using r-project.org> On Behalf Of javed khan
> > Sent: Wednesday, January 26, 2022 2:47 PM
> > To: R-help <r-help using r-project.org>
> > Subject: [R] Error in if (fraction <= 1) { : missing value where
> TRUE/FALSE
> > needed
> >
> > I get this error:
> >
> > 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.
> >
> > Where could be the problem?
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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