Re: [R] NAs are removed

2022-01-14 Thread Avi Gross via R-help
I do not know what your major problem/issue is but the code you shared seems to 
be looking for a character value of '2' in what looks like a numeric vector 
containing the number 2.


-Original Message-
From: Neha gupta 
To: Ebert,Timothy Aaron 
Cc: r-help mailing list 
Sent: Fri, Jan 14, 2022 5:11 pm
Subject: Re: [R] NAs are removed

I have a variable in dataset "CA", which has the following values:

[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1
 [40] 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

then I used this statement

prot <- ifelse(ts$CA == '2', 0, 1)

Is the problem exist here?


On Fri, Jan 14, 2022 at 11:02 PM Ebert,Timothy Aaron  wrote:

> Hi Neha,
>    You used a variable named "fraction" so we took a guess. However, as
> another pointed out 1/0 does not give NA in R. number/0 returns Inf except
> 0/0 which returns NaN. So 1/0 <= 1 returns FALSE and 0/0 <= 1 returns NA. A
> great deal of the behavior of your program hinges on what "fraction" is in
> your program.
>
> Tim
>
> -Original Message-
> From: R-help  On Behalf Of Neha gupta
> Sent: Friday, January 14, 2022 4:50 PM
> To: Jim Lemon 
> Cc: r-help mailing list 
> Subject: Re: [R] NAs are removed
>
> [External Email]
>
> Hi Jim and Ebert
>
> How I am using divide by zero, I did not understand? I am using caret and
> AUC metric.
>
> If I do, what is the solution?
>
> On Fri, Jan 14, 2022 at 9:41 PM Jim Lemon  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 
> > 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@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_ma
> > > ilman_listinfo_r-2Dhelp=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2k
> > > VeAsRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06S
> > > kfQKtGPM2OWM5=LqAgI3qNLyTF5KeFM9sT9jTT4rkvlcJa1V9CIW_SVy4=
> > > PLEASE do read the posting guide
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.or
> > g_posting-2Dguide.html=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeA
> > sRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06SkfQKt
> > GPM2OWM5=hUs_mg3eaWhd-I4H-9rKF6C4B7CFwLsuBkx3Qv68_o0=
> > > and provide commented, minimal, self-contained, reproducible code.
> >
>
>        [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeAsRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06SkfQKtGPM2OWM5=LqAgI3qNLyTF5KeFM9sT9jTT4rkvlcJa1V9CIW_SVy4=
> PLEASE do read the posting guide
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeAsRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06SkfQKtGPM2OWM5=hUs_mg3eaWhd-I4H-9rKF6C4B7CFwLsuBkx3Qv68_o0=
> and provide commented, minimal, self-containe

Re: [R] NAs are removed

2022-01-14 Thread Ebert,Timothy Aaron
I don’t see any. To support this claim I tried it (but no dataframe):
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)
prot <- ifelse(CA == '2', 0, 1)
print(prot)

R responds:
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[37] 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 0 0 0
[73] 0 0 0 0 0 0

You can check other statements in the same way. That said, in a huge dataset 
you might want to ask if the data provided match what you are assuming is 
there. If you type unique(ts$CA) do you get anything other than 1 and 2? This 
is a common task of figuring out if the problem is with the code or the data.

Tim
From: Neha gupta 
Sent: Friday, January 14, 2022 5:11 PM
To: Ebert,Timothy Aaron 
Cc: Jim Lemon ; r-help mailing list 
Subject: Re: [R] NAs are removed

[External Email]
I have a variable in dataset "CA", which has the following values:

[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1
 [40] 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

then I used this statement

prot <- ifelse(ts$CA == '2', 0, 1)

Is the problem exist here?

On Fri, Jan 14, 2022 at 11:02 PM Ebert,Timothy Aaron 
mailto:teb...@ufl.edu>> wrote:
Hi Neha,
   You used a variable named "fraction" so we took a guess. However, as another 
pointed out 1/0 does not give NA in R. number/0 returns Inf except 0/0 which 
returns NaN. So 1/0 <= 1 returns FALSE and 0/0 <= 1 returns NA. A great deal of 
the behavior of your program hinges on what "fraction" is in your program.

Tim

-Original Message-
From: R-help 
mailto:r-help-boun...@r-project.org>> On Behalf 
Of Neha gupta
Sent: Friday, January 14, 2022 4:50 PM
To: Jim Lemon mailto:drjimle...@gmail.com>>
Cc: r-help mailing list mailto:r-help@r-project.org>>
Subject: Re: [R] NAs are removed

[External Email]

Hi Jim and Ebert

How I am using divide by zero, I did not understand? I am using caret and AUC 
metric.

If I do, what is the solution?

On Fri, Jan 14, 2022 at 9:41 PM Jim Lemon 
mailto:drjimle...@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 
> mailto:neha.bologn...@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@r-project.org<mailto:R-help@r-project.org> mailing list -- To 
> > UNSUBSCRIBE and more, see
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_ma
> > ilman_listinfo_r-2Dhelp=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2k
> > VeAsRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06S
> > kfQKtGPM2OWM5=LqAgI3qNLyTF5KeFM9sT9jTT4rkvlcJa1V9CIW_SVy4=
> > PLEASE do read the posting guide
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.or
> g_posting-2Dguide.html=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeA
> sRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06SkfQKt
> GPM2OWM5=hUs_mg3eaWhd-I4H-9rKF6C4B7CFwLsuBkx3Qv68_o0=
> > and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org<mailto:R-help@r-project.org> mailing list -- To 
UNSUBSCRIBE and more

Re: [R] NAs are removed

2022-01-14 Thread Neha gupta
I have a variable in dataset "CA", which has the following values:

[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1
 [40] 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

then I used this statement

prot <- ifelse(ts$CA == '2', 0, 1)

Is the problem exist here?


On Fri, Jan 14, 2022 at 11:02 PM Ebert,Timothy Aaron  wrote:

> Hi Neha,
>You used a variable named "fraction" so we took a guess. However, as
> another pointed out 1/0 does not give NA in R. number/0 returns Inf except
> 0/0 which returns NaN. So 1/0 <= 1 returns FALSE and 0/0 <= 1 returns NA. A
> great deal of the behavior of your program hinges on what "fraction" is in
> your program.
>
> Tim
>
> -Original Message-
> From: R-help  On Behalf Of Neha gupta
> Sent: Friday, January 14, 2022 4:50 PM
> To: Jim Lemon 
> Cc: r-help mailing list 
> Subject: Re: [R] NAs are removed
>
> [External Email]
>
> Hi Jim and Ebert
>
> How I am using divide by zero, I did not understand? I am using caret and
> AUC metric.
>
> If I do, what is the solution?
>
> On Fri, Jan 14, 2022 at 9:41 PM Jim Lemon  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 
> > 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@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_ma
> > > ilman_listinfo_r-2Dhelp=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2k
> > > VeAsRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06S
> > > kfQKtGPM2OWM5=LqAgI3qNLyTF5KeFM9sT9jTT4rkvlcJa1V9CIW_SVy4=
> > > PLEASE do read the posting guide
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.or
> > g_posting-2Dguide.html=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeA
> > sRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06SkfQKt
> > GPM2OWM5=hUs_mg3eaWhd-I4H-9rKF6C4B7CFwLsuBkx3Qv68_o0=
> > > and provide commented, minimal, self-contained, reproducible code.
> >
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeAsRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06SkfQKtGPM2OWM5=LqAgI3qNLyTF5KeFM9sT9jTT4rkvlcJa1V9CIW_SVy4=
> PLEASE do read the posting guide
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeAsRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06SkfQKtGPM2OWM5=hUs_mg3eaWhd-I4H-9rKF6C4B7CFwLsuBkx3Qv68_o0=
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] NAs are removed

2022-01-14 Thread Ebert,Timothy Aaron
Hi Neha,
   You used a variable named "fraction" so we took a guess. However, as another 
pointed out 1/0 does not give NA in R. number/0 returns Inf except 0/0 which 
returns NaN. So 1/0 <= 1 returns FALSE and 0/0 <= 1 returns NA. A great deal of 
the behavior of your program hinges on what "fraction" is in your program.

Tim

-Original Message-
From: R-help  On Behalf Of Neha gupta
Sent: Friday, January 14, 2022 4:50 PM
To: Jim Lemon 
Cc: r-help mailing list 
Subject: Re: [R] NAs are removed

[External Email]

Hi Jim and Ebert

How I am using divide by zero, I did not understand? I am using caret and AUC 
metric.

If I do, what is the solution?

On Fri, Jan 14, 2022 at 9:41 PM Jim Lemon  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 
> 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@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_ma
> > ilman_listinfo_r-2Dhelp=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2k
> > VeAsRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06S
> > kfQKtGPM2OWM5=LqAgI3qNLyTF5KeFM9sT9jTT4rkvlcJa1V9CIW_SVy4=
> > PLEASE do read the posting guide
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.or
> g_posting-2Dguide.html=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeA
> sRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06SkfQKt
> GPM2OWM5=hUs_mg3eaWhd-I4H-9rKF6C4B7CFwLsuBkx3Qv68_o0=
> > and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeAsRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06SkfQKtGPM2OWM5=LqAgI3qNLyTF5KeFM9sT9jTT4rkvlcJa1V9CIW_SVy4=
PLEASE do read the posting guide 
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeAsRzsn7AkP-g=WsafNBaOwXzuF-v3jJZaUbBRngZTxjDnPCJN1jlMOzYqG9yy06SkfQKtGPM2OWM5=hUs_mg3eaWhd-I4H-9rKF6C4B7CFwLsuBkx3Qv68_o0=
and provide commented, minimal, self-contained, reproducible code.

__
R-help@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.


Re: [R] NAs are removed

2022-01-14 Thread Neha gupta
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 
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 
> wrote:
>
>> Unlikely.
>>
>> > 1/0
>> [1] Inf  ## not NA
>>
>> Bert
>>
>> On Fri, Jan 14, 2022 at 12:41 PM Jim Lemon  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 
>> > 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@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@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@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@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.


Re: [R] NAs are removed

2022-01-14 Thread Neha gupta
Hi Jim and Ebert

How I am using divide by zero, I did not understand? I am using caret and
AUC metric.

If I do, what is the solution?

On Fri, Jan 14, 2022 at 9:41 PM Jim Lemon  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 
> 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@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@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.


Re: [R] NAs are removed

2022-01-14 Thread Bill Dunlap
> 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  wrote:

> Unlikely.
>
> > 1/0
> [1] Inf  ## not NA
>
> Bert
>
> On Fri, Jan 14, 2022 at 12:41 PM Jim Lemon  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 
> > 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@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@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@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@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.


Re: [R] NAs are removed

2022-01-14 Thread Duncan Murdoch

On 14/01/2022 3:54 p.m., Bert Gunter wrote:

Unlikely.


1/0

[1] Inf  ## not NA


However:

> if (0/0 <= 1) print("something")
Error in if (0/0 <= 1) print("something") :
  missing value where TRUE/FALSE needed

Duncan Murdoch



Bert

On Fri, Jan 14, 2022 at 12:41 PM Jim Lemon  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 
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@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@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@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@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.


Re: [R] NAs are removed

2022-01-14 Thread Bert Gunter
Unlikely.

> 1/0
[1] Inf  ## not NA

Bert

On Fri, Jan 14, 2022 at 12:41 PM Jim Lemon  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 
> 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@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@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@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.


Re: [R] NAs are removed

2022-01-14 Thread Jim Lemon
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  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@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@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] NAs are removed

2022-01-14 Thread Neha gupta
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@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.