Dear Mr. Thierry,

Thanks a lot for pointing out such a silly mistake from my side. I was simply wondering how come I am not getting such a simple mean. 

Thanks again.

Vincy

--- On Tue, 5/22/12, ONKELINX, Thierry <Thierry.ONKELINX@inbo.be> wrote:

From: ONKELINX, Thierry <Thierry.ONKELINX@inbo.be>
Subject: RE: [R] What's wrong with MEAN?
To: "Vincy Pyne" <vincy_pyne@yahoo.ca>, "r-help@r-project.org" <r-help@r-project.org>
Received: Tuesday, May 22, 2012, 9:17 AM

You'll need to pass the data as a vector.

mean(16, 18) is asking the mean of 16. 18 is passed to the second argument which is trim. So you are doing mean(16, trim = 18)

What you want is

mean(c(16, 18))

Best regards,

Thierry

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
Thierry.Onkelinx@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey


-----Oorspronkelijk bericht-----
Van: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org] Namens Vincy Pyne
Verzonden: dinsdag 22 mei 2012 11:10
Aan: r-help@r-project.org
Onderwerp: [R] What's wrong with MEAN?


Dear R helpers,

I have recently installed R version 2.15.0

I just wanted to calculate

mean(16, 18)

Surprisingly I got answer as

> mean(16, 18)
[1] 16


> mean(18, 16)

[1] 18

> mean(14, 11, 17, 9, 5, 18)
[1] 14


So instead of calculating simple Arithmetic average, mean command is generating first element as average. I restarted the machine, changed the machine, but still the reply is same. I have been using this mean function ever since I strated learning R, but this has never happened.

Kindly guide

Vincy




        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.

	[[alternative HTML version deleted]]

