[R] NAs are removed
Neha gupta
neh@@bo|ogn@90 @end|ng |rom gm@||@com
Fri Jan 14 22:53:12 CET 2022
I have a variable CA which has a value of 1 or 2, and I am using this code
in if statement
prot <- ifelse(ts$CA == '2', 0, 1)
On Fri, Jan 14, 2022 at 10:04 PM Bill Dunlap <williamwdunlap using gmail.com>
wrote:
> > fraction <- 0/0
> > if (fraction < .5) TRUE else FALSE
> Error in if (fraction < 0.5) TRUE else FALSE :
> missing value where TRUE/FALSE needed
>
> -Bill
>
> On Fri, Jan 14, 2022 at 12:55 PM Bert Gunter <bgunter.4567 using gmail.com>
> wrote:
>
>> Unlikely.
>>
>> > 1/0
>> [1] Inf ## not NA
>>
>> Bert
>>
>> On Fri, Jan 14, 2022 at 12:41 PM Jim Lemon <drjimlemon using gmail.com> wrote:
>>
>> > Hi Neha,
>> > You're using the argument "na.omit" in what function? My blind guess
>> > is that there's a divide by zero shooting you from behind.
>> >
>> > Jim
>> >
>> > On Sat, Jan 15, 2022 at 6:32 AM Neha gupta <neha.bologna90 using gmail.com>
>> > wrote:
>> > >
>> > > Hi everyone
>> > >
>> > > I use na.omit to remove NAs but still it gives me error
>> > >
>> > > Error in if (fraction <= 1) { : missing value where TRUE/FALSE needed
>> > >
>> > > My data is:
>> > >
>> > > data.frame': 340 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 1 1 1 1 1 3 3 3 3 ...
>> > > $ LOC : num 3 4 3 3 4 4 10 10 10 10 ...
>> > > $ DepthNested : num 1 1 1 1 1 1 2 2 2 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",..: 2 2 4 13 13
>> 13
>> > 1 3
>> > > 4 7 ...
>> > > $ methodReturn : Factor w/ 22 levels "I","V","Z","method",..: 2 2 2
>> 2 2
>> > 2
>> > > 2 2 2 2 ...
>> > >
>> > > [[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.
>> >
>> > ______________________________________________
>> > 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]]
>>
>> ______________________________________________
>> 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