[R] result of mean(v1, v2, v3) of three real number not the same as sum(v1, v2, v3)/3
Sorkin, John
j@ork|n @end|ng |rom @om@um@ry|@nd@edu
Thu May 12 21:45:12 CEST 2022
Ivan,
Thank you for your quick reply. Unfortunately, I don't understand the concept you are trying toe explain. Can you try again?
Thank you,
John
________________________________________
From: Ivan Krylov <krylov.r00t using gmail.com>
Sent: Thursday, May 12, 2022 3:41 PM
To: Sorkin, John
Cc: r-help using r-project.org
Subject: Re: [R] result of mean(v1, v2, v3) of three real number not the same as sum(v1, v2, v3)/3
On Thu, 12 May 2022 19:31:51 +0000
"Sorkin, John" <jsorkin using som.umaryland.edu> wrote:
> > mean(mlagFZ1,mlagFZ2,mlagFZ3)
> [1] -0.3326792
match.call(mean.default, quote(mean(mlagFZ1, mlagFZ2, mlagFZ3)))
# mean(x = mlagFZ1, trim = mlagFZ2, na.rm = mlagFZ3)
mean() takes a vector to compute a mean of and additional arguments,
unlike sum(), which takes ... (almost arbitrary arguments) and sums all
of them. Unfortunately, the "trim" argument is documented to accept any
number and the na.rm argument is silently reinterpreted as logical in
your case.
--
Best regards,
Ivan
More information about the R-help
mailing list