[R] question on mean, sum
bhh at xs4all.nl
Mon Nov 14 08:44:24 CET 2016
In addition to Petr's remarks:
- why are you doing sum(mtcars)? Do you want the sum of first column of mtcars? In that case you should do sum(mtcars[,1]).
- similar remarks apply to your use of mean and sd.
Have you read an introduction to R?
> On 14 Nov 2016, at 04:01, mokuram at sina.com wrote:
> I am working on functions such as sum(), mean() ...
>> sum(mtcars) 13942.2> mean(mtcars) NAWarning message:In mean.default(mtcars) : NA> sd(mtcars)Error in is.data.frame(x) : ()'double'
> why got different reply?Is this a BUG for the current version of R?my version info:version.string R version 3.3.1 (2016-06-21)
> Thank you very much for the help.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help