ioned earlier, Python brags
about how flexible their truthy/falsy can be. True.
-Original Message-
From: R-help On Behalf Of Bert Gunter
Sent: Friday, December 13, 2024 6:32 PM
To: Ben Bolker
Cc: r-help@r-project.org
Subject: Re: [R] Weird Behavior of mean
Sounds reasonable, but I leave
Sounds reasonable, but I leave it to wiser heads than me to decide. My
only point is that whatever is done be accurately documented. At
present, that does not appear to be the case. ... and yes, "accurate"
documentation is not easy either.
-- Bert
On Fri, Dec 13, 2024 at 3:20 PM Ben Bolker wrote
My preference would be for anything that is defined as taking a
"logical" parameter to report an error if given anything else.
On Sat, 14 Dec 2024 at 12:21, Ben Bolker wrote:
>
>Thanks, I had missed/forgotten the fact that there is also an
> inconsistency between mean.default() and sd().
>
>
Thanks, I had missed/forgotten the fact that there is also an
inconsistency between mean.default() and sd().
sd() calls var(), which evaluates if(na.rm) [i.e., it will try to
coerce `na.rm` to logical rather than testing isTRUE]
IM(H?)O, it would be best for both mean.default() and sd()
Ivo, et al.:
--IMHO only ... and with apologies for verbosity
Defining, let alone enforcing, "consistent behavior" can be a
philosophical conundrum: what one person deems "consistent" behavior
for a function across different data structures and circumstances may
not be the same as another's. While
less error prone.
I don't blame you for being teed off at why things where not working when T
was redefined.
-Original Message-
From: R-help On Behalf Of Ivo Welch
Sent: Thursday, December 12, 2024 7:23 PM
To: r-help@r-project.org
Subject: [R] Weird Behavior of mean
Is the follow
This was documented in [1] forever ago. I would not miss it if a future version
of R chose to remove those variables.
[1] The R Inferno, 8.1.32
On December 13, 2024 11:21:13 AM PST, ivo welch wrote:
>isn't this still a little R buglet? I have overwritten T (even if my
>schuld [franconian], it
This example is a little more subtle than that; the OP knows about
name masking, but was expecting T to be coerced to logical, which
would ordinarily be a reasonable expectation (IMO) ...
On Fri, Dec 13, 2024 at 3:40 PM Jeff Newmiller via R-help
wrote:
>
> This was documented in [1] forever ago
isn't this still a little R buglet? I have overwritten T (even if my
schuld [franconian], it is not that uncommon an error, because T is also a
common abbreviation for the end of a time series; namespace pollution in R
can be quite annoying, even though I understand that it is convenient in
intera
> CALUM POLWART
> on Fri, 13 Dec 2024 08:56:15 + writes:
> I've not checked the code, but I think that result would
> happen if mean uses something like
> if (na.rm == TRUE) { # do something to remove the NA's }
> And as uses something like
> If (na.rm != FA
I've not checked the code, but I think that result would happen if mean
uses something like
if (na.rm == TRUE) {
# do something to remove the NA's
}
And as uses something like
If (na.rm != FALSE) {
# do something to remove the NA's
}
Or perhaps ever na.rm == T
If you ever see posts from B
Is the following a strange behavior for `mean` vs. `sd` ?
```
$ R --vanilla. ## 4.4.2
> x=c(NA,1,2,3)
> c( mean(x,na.rm=T), sd(x,na.rm=T) )
[1] 2 1
> T=20 ## bad idea for a parameter. T is also used for TRUE
> c( mean(x,na.rm=T), sd(x,na.rm=T) )
[1] NA 1
>
```
This one was a baffler for me to
12 matches
Mail list logo