.
Without clear requirements, there often is no right answer.
-Original Message-
From: R-help On Behalf Of Rui Barradas
Sent: Saturday, December 4, 2021 2:34 AM
To: Bert Gunter
Cc: R-help
Subject: Re: [R] Find tibble row with maximum recorded value
Hello,
You're right, I carelessly
Hello,
You're right, I carelessly coded this.
which.max returns the index to the first maximum of a vector, while the
comparison of a vector with its max() returns an index to all vector
elements.
Às 23:27 de 03/12/21, Bert Gunter escreveu:
Perhaps you meant to point this out, but the cfs[w
On Fri, 3 Dec 2021, Rich Shepard wrote:
they apparently do. For example, 99.9000 cubic feet per second is reached
99,900
Rich
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.c
On Fri, 3 Dec 2021, Bert Gunter wrote:
Perhaps you meant to point this out, but the cfs[which.max(cfs)] and
cfs == ... are not the same:
x <- rep(1:2,3)
x
[1] 1 2 1 2 1 2
x[which.max(x)]
[1] 2
x[x==max(x)]
[1] 2 2 2
So maybe your point is: which does the OP want (in case there are
repeat
Perhaps you meant to point this out, but the cfs[which.max(cfs)] and
cfs == ... are not the same:
> x <- rep(1:2,3)
> x
[1] 1 2 1 2 1 2
> x[which.max(x)]
[1] 2
> x[x==max(x)]
[1] 2 2 2
So maybe your point is: which does the OP want (in case there are
repeated maxes)? I suspect the == forms, but .
On Fri, 3 Dec 2021, Rui Barradas wrote:
which.max(pdx_disc$cfs)
[1] 8054
This is the *index* for which cfs is the first maximum, not the maximum
value itself.
Rui,
Mea culpa! I completely forgot this.
Therefore, you probably want any of
filter(pdx_disc, cfs == cfs[8054])
filter(pdx_disc,
Hello,
Inline.
Às 22:08 de 03/12/21, Rich Shepard escreveu:
On Fri, 3 Dec 2021, Rich Shepard wrote:
I find solutions when the data_frame is grouped, but none when it's not.
Thanks, Bert. ?which.max confirmed that's all I need to find the maximum
value.
Now I need to read more than ?filter
On Fri, 3 Dec 2021, Rich Shepard wrote:
I find solutions when the data_frame is grouped, but none when it's not.
Thanks, Bert. ?which.max confirmed that's all I need to find the maximum
value.
Now I need to read more than ?filter to learn why I'm not getting the
relevant row with:
which.max(
On Fri, 3 Dec 2021, Jeff Newmiller wrote:
cfs is not a function. Don't put parentheses next to it. Use square
brackets for indexing.
Jeff,
Thanks.
Rich
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailm
cfs is not a function. Don't put parentheses next to it. Use square brackets
for indexing.
On December 3, 2021 12:55:34 PM PST, Rich Shepard
wrote:
>I find solutions when the data_frame is grouped, but none when it's not.
>
>The data:
># A tibble: 813,693 × 9
>site_nbr year mon day
which.max(dat$cfs), I presume.
see ?which.max
(as usual, true tidyverse questions belong on RStudio's help site, not here).
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
I find solutions when the data_frame is grouped, but none when it's not.
The data:
# A tibble: 813,693 × 9
site_nbr year mon dayhr min tz cfs sampdt
1 14211720 198810 1 010 PDT 16800 1988-10-01 00:10:00
2 14211720 198810 1 02
12 matches
Mail list logo