Re: [Rd] mean

2020-01-09 Thread Stephen Ellison
Note that in > > quantile(c("1","2","3"),p=.5) > Error in (1 - h) * qs[i] : > argument non numérique pour un opérateur binaire the default quantile type (7) does not work for non-numerics. Quantile types 1 and 3 work as expected: > quantile(c("1","2","3"),p=.5, type=1) 50% "2" >

Re: [Rd] mean

2020-01-09 Thread Marc Schwartz via R-devel
gt;>> return(x[FALSE][NA]) : >>> l'argument n'est pas interprétable comme une valeur logique >>> De plus : Warning message: >>> In if (na.rm) x <- x[!is.na(x)] else if (any(is.na(x))) >>> return(x[FALSE][NA]) : >>> la condition a une longueur &g

Re: [Rd] mean

2020-01-09 Thread peter dalgaard
return(x[FALSE][NA]) : >> l'argument n'est pas interprétable comme une valeur logique >> De plus : Warning message: >> In if (na.rm) x <- x[!is.na(x)] else if (any(is.na(x))) return(x[FALSE][NA]) >> : >> la condition a une longueur > 1 et seul le premier élément

Re: [Rd] mean

2020-01-09 Thread Marc Schwartz via R-devel
st on arguments like? > if (!is.numeric(x)) > stop("need numeric data") > > > -Message d'origine- > De : Marc Schwartz > Envoyé : jeudi 9 janvier 2020 14:19 > À : Lipatz Jean-Luc > Cc : R-Devel > Objet : Re: [Rd] mean > >

Re: [Rd] mean

2020-01-09 Thread Marc Schwartz via R-devel
> On Jan 9, 2020, at 7:40 AM, Lipatz Jean-Luc wrote: > > Hello, > > Is there a reason for the following behaviour? >> mean(c("1","2","3")) > [1] NA > Warning message: > In mean.default(c("1", "2", "3")) : > l'argument n'est ni numérique, ni logique : renvoi de NA > > But: >>

[Rd] mean

2020-01-09 Thread Lipatz Jean-Luc
Hello, Is there a reason for the following behaviour? > mean(c("1","2","3")) [1] NA Warning message: In mean.default(c("1", "2", "3")) : l'argument n'est ni numérique, ni logique : renvoi de NA But: > var(c("1","2","3")) [1] 1 And also: > median(c("1","2","3")) [1] "2" But: >

Re: [Rd] mean(x) for ALTREP

2018-04-26 Thread Gabe Becker
Serguei, The R 3.5.0 release includes the fundamental ALTREP framework but does not include many 'hooks' within R's source code to make use of methods on the ALTREP custom vector classes. I have implemented a fair number, including for mean() to use the custom Sum method when available, in the

[Rd] mean(x) for ALTREP

2018-04-26 Thread Serguei Sokol
Hi, By looking at a doc about ALTREP https://svn.r-project.org/R/branches/ALTREP/ALTREP.html (by the way congratulations for that and for R-3.5.0 in general), I was a little bit surprised by the following example: > x <- 1:1e10 > system.time(print(mean(x))) [1] 5e+09    user  system elapsed

Re: [Rd] mean(x) != mean(rev(x)) different with x <- c(NA, NaN) for some builds

2017-04-01 Thread Hervé Pagès
On 03/31/2017 10:14 PM, Prof Brian Ripley wrote: From ?NA Numerical computations using ‘NA’ will normally result in ‘NA’: a possible exception is where ‘NaN’ is also involved, in which case either might result. and ?NaN Computations involving ‘NaN’ will return ‘NaN’ or

Re: [Rd] mean(x) != mean(rev(x)) different with x <- c(NA, NaN) for some builds

2017-04-01 Thread Henrik Bengtsson
Although help("is.nan") says: "Computations involving NaN will return NaN or perhaps NA: ..." it might not be obvious that this is also why one may get: > mean(c(-Inf, +Inf, NA)) [1] NaN > mean(c(-Inf, NA, +Inf)) [1] NA This is because internally the intermediate sum +Inf + -Inf is NaN in

Re: [Rd] mean(x) != mean(rev(x)) different with x <- c(NA, NaN) for some builds

2017-03-31 Thread Henrik Bengtsson
On Fri, Mar 31, 2017 at 10:14 PM, Prof Brian Ripley wrote: > From ?NA > > Numerical computations using ‘NA’ will normally result in ‘NA’: a > possible exception is where ‘NaN’ is also involved, in which case > either might result. > > and ?NaN > >

Re: [Rd] mean(x) != mean(rev(x)) different with x <- c(NA, NaN) for some builds

2017-03-31 Thread Prof Brian Ripley
From ?NA Numerical computations using ‘NA’ will normally result in ‘NA’: a possible exception is where ‘NaN’ is also involved, in which case either might result. and ?NaN Computations involving ‘NaN’ will return ‘NaN’ or perhaps ‘NA’: which of those two is not

[Rd] mean(x) != mean(rev(x)) different with x <- c(NA, NaN) for some builds

2017-03-31 Thread Henrik Bengtsson
In R 3.3.3, I observe the following on Ubuntu 16.04 (when building from source as well as for the sudo apt r-base build): > x <- c(NA, NaN) > mean(x) [1] NA > mean(rev(x)) [1] NaN > rowMeans(matrix(x, nrow = 1, ncol = 2)) [1] NA > rowMeans(matrix(rev(x), nrow = 1, ncol = 2)) [1] NaN >

Re: [Rd] mean(trim=, c(NA,...), na.rm=FALSE) does not return NA

2010-03-18 Thread Prof Brian Ripley
On Tue, 16 Mar 2010, William Dunlap wrote: Both of the following should return NA, but do not in R version 2.11.0 Under development (unstable) (2010-03-07 r51225) on 32-bit Windows: Nor in any version of R in the last several years (e.g. 2.1.0) mean(c(1,10,100,NA), trim=.1) Error in

[Rd] mean(trim=, c(NA,...), na.rm=FALSE) does not return NA

2010-03-16 Thread William Dunlap
Both of the following should return NA, but do not in R version 2.11.0 Under development (unstable) (2010-03-07 r51225) on 32-bit Windows: mean(c(1,10,100,NA), trim=.1) Error in sort.int(x, partial = unique(c(lo, hi))) : index 4 outside bounds mean(c(1,10,100,NA), trim=.26) [1] 55

[Rd] 'mean' is not reverted in median() as NEWS says (PR#13731)

2009-05-29 Thread zhengxin
Full_Name: Version: 2.9.0 OS: windows, linux Submission from: (NULL) (128.231.21.125) In NEWS, it says median.default() was altered in 2.8.1 to use sum() rather than mean(), although it was still documented to use mean(). This caused problems for POSIXt objects, for which mean()

Re: [Rd] 'mean' is not reverted in median() as NEWS says (PR#13731)

2009-05-29 Thread Peter Dalgaard
zheng...@mail.nih.gov wrote: Full_Name: Version: 2.9.0 OS: windows, linux Submission from: (NULL) (128.231.21.125) In NEWS, it says median.default() was altered in 2.8.1 to use sum() rather than mean(), although it was still documented to use mean(). This caused problems for

[Rd] mean (PR#10864)

2008-02-28 Thread paulponcet
Full_Name: Paul PONCET Version: 2.6.0 OS: Windows 2000 Submission from: (NULL) (83.137.240.218) Function 'mean.default' calls function 'stats::median' if 'trim = 0.5'. In that case the call should be 'stats::median(x, na.rm = na.rm)' instead of 'stats::median(x, na.rm = FALSE)'.

Re: [Rd] mean mailing list moderator ..

2007-11-07 Thread Hin-Tak Leung
There is a simple solution to this kind of problem - for my non-day-job-related software stuff, I usually subscribe under my sourceforge address. Sourceforge's is simple re-direction service so I actually cannot post from it; but I like incoming e-mails to go through sourceforge for a double spam

Re: [Rd] mean mailing list moderator ..

2007-11-07 Thread Martin Maechler
Hi Jari, (and interested readers) JO == Jari Oksanen [EMAIL PROTECTED] on Wed, 07 Nov 2007 12:21:10 +0200 writes: [..] [...some very good stuff...] [..] JO Cheers, Jari Oksanen JO PS. Please Mr Moderator, don't treat me so

Re: [Rd] ?mean

2007-01-26 Thread Berwin A Turlach
G'day Gabor, On Thu, 25 Jan 2007 09:53:49 -0500 Gabor Grothendieck [EMAIL PROTECTED] wrote: The help page for mean does not say what happens when one applies mean to a matrix. Well, not directly. :-) But the help page of mean says that one of the arguments is: x: An R object.

[Rd] ?mean

2007-01-25 Thread Gabor Grothendieck
The help page for mean does not say what happens when one applies mean to a matrix. mean and sd work in an inconsistent way on a matrix so that should at least be documented. Also there should be a See Also to colMeans since that provides the missing column-wise analog to sd.

Re: [Rd] ?mean

2007-01-25 Thread Martin Maechler
Gabor == Gabor Grothendieck [EMAIL PROTECTED] on Thu, 25 Jan 2007 09:53:49 -0500 writes: Gabor The help page for mean does not say what happens when one Gabor applies mean to a matrix. Gabor mean and sd work in an inconsistent way on a matrix Gabor so that should at least

Re: [Rd] ?mean

2007-01-25 Thread Gabor Grothendieck
Good point. Perhaps what is needed is a Note clarifying all this in ?mean (unless the software itself is reworked as Martin has discussed). Regarding var(x), one could use sd(x)^2. On 1/25/07, Berwin A Turlach [EMAIL PROTECTED] wrote: G'day Gabor, On Thu, 25 Jan 2007 09:53:49 -0500 Gabor

[Rd] mean relative differences from all.equal() (PR#9276)

2006-10-04 Thread bchristo
Full_Name: Brad Christoffersen Version: 2.3.1 OS: Windows XP Submission from: (NULL) (128.196.193.132) Why is the difference between two numbers so different from the mean relative difference output from the all.equal() function? Is this an artifact of the way R stores numerics? I could not

Re: [Rd] mean relative differences from all.equal() (PR#9276)

2006-10-04 Thread MSchwartz
On Thu, 2006-10-05 at 03:10 +0200, [EMAIL PROTECTED] wrote: Full_Name: Brad Christoffersen Version: 2.3.1 OS: Windows XP Submission from: (NULL) (128.196.193.132) Why is the difference between two numbers so different from the mean relative difference output from the all.equal()

Re: [Rd] mean relative differences from all.equal() (PR#9276)

2006-10-04 Thread MSchwartz
On Wed, 2006-10-04 at 20:22 -0500, Marc Schwartz wrote: On Thu, 2006-10-05 at 03:10 +0200, [EMAIL PROTECTED] wrote: Full_Name: Brad Christoffersen Version: 2.3.1 OS: Windows XP Submission from: (NULL) (128.196.193.132) Why is the difference between two numbers so different from

Re: [Rd] mean relative differences from all.equal() (PR#9276)

2006-10-04 Thread Marc Schwartz
On Wed, 2006-10-04 at 21:57 -0500, Marc Schwartz wrote: On Wed, 2006-10-04 at 20:22 -0500, Marc Schwartz wrote: On Thu, 2006-10-05 at 03:10 +0200, [EMAIL PROTECTED] wrote: Full_Name: Brad Christoffersen Version: 2.3.1 OS: Windows XP Submission from: (NULL) (128.196.193.132)

[Rd] mean(NA) returns -(1+.Machine$integer.max) (PR#9097)

2006-07-25 Thread btyner
Full_Name: Benjamin Tyner Version: 2.3.0 OS: linux-gnu (debian) Submission from: (NULL) (71.98.75.54) mean(NA) returns -2147483648 on my system, which is -(1+.Machine$integer.max) sessionInfo() Version 2.3.0 (2006-04-24) i686-pc-linux-gnu attached base packages: [1] methods stats

[Rd] mean of complex vector (PR#8842)

2006-05-08 Thread john . peters
Full_Name: John Peters Version: 2.3.0 OS: Windows 2000, xp Submission from: (NULL) (220.233.20.203) In R2.3.0 on Windows 2000 and xp mean(c(1i)) [1] 0+2i mean(c(1i,1i)) [1] 0+3i mean(c(1i,1i,1i)) [1] 0+4i OK in R2.2.1 __ R-devel@r-project.org