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,
this is a related issue. For this example, the ifelse statement is 10 times
slower than
a much simpler != comparison.
> tmp <- sample(1:2, 40, TRUE)
> tmp
[1] 2 2 2 2 1 2 1 2 1 1 1 1 1 2 1 2 2 1 1 2 1 2 2 2 1 1 1 2 2 1 2 1 1 1 2 1 2
1 2 2
> ifelse(tmp==2, 0, 1)
[1] 0 0 0 0 1 0 1 0 1 1 1 1 1
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,
Dear Jeff,
I am sending an updated version of the code.
The initial version assumed that the time points correspond to an
integer sequence. The code would fail for arbitrary times.
The new code is robust. I still assume that the data is in column-format
and that you want the time to the
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)
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
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 :
>
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
> 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
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
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
>
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 <=
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
Dear Paul,
On 2022-01-14 1:17 p.m., Paul Bernal wrote:
Dear John and R community friends,
To be a little bit more specific, what I need to accomplish is the
creation of a confidence interval ellipse over a scatterplot at
different percentiles. The confidence interval ellipses should be drawn
On 14/01/2022 1:17 p.m., Paul Bernal wrote:
Dear John and R community friends,
To be a little bit more specific, what I need to accomplish is the creation
of a confidence interval ellipse over a scatterplot at different
percentiles. The confidence interval ellipses should be drawn over the
Dear John and R community friends,
To be a little bit more specific, what I need to accomplish is the creation
of a confidence interval ellipse over a scatterplot at different
percentiles. The confidence interval ellipses should be drawn over the
scatterplot.
Any other guidance will be greatly
> Gerrit Eichner
> on Fri, 14 Jan 2022 16:42:28 +0100 writes:
> Hi Paul, take a look at base R's function contour (and the
> Examples section of its help page), and follow maybe the
> hints under "See also".
> Hth -- Gerrit
Also, with Recommended packages
Dear Paul,
As I understand it, the ellipse package is meant for drawing confidence
ellipses, not density (i.e., data) ellipses. You should be able to use
ellipse::ellipse() to draw a bivariate-normal density ellipse (assuming
that's what you want), but you'll have to do some computation
Hi Paul,
take a look at base R's function contour (and the Examples section
of its help page), and follow maybe the hints under "See also".
Hth -- Gerrit
-
Dr. Gerrit Eichner Mathematical Institute, Room
Dear R friends,
Happy new year to you all. Not quite sure if this is the proper place to
ask about this, so I apologize if it is not, and if it isn´t, maybe you can
point me to the right place.
I would like to know if there is any R package that allows me to produce
density ellipses. Searching
20 matches
Mail list logo