using R-2.15.2 on Windows XP I get a different maximum from summary() than from max().
Why is that so?
Here is the relevant code:
> class(dat)
[1] "data.frame"
> dim(dat)
[1] 3850 54
> summary(dat$enrol)
Min. 1st Qu. Median Mean 3rd Qu. Max.
26 945 1744 3044 3128 183200
> max(dat$enrol)
[1] 183151
Any ideas why summary() rounds the result up?
Best
Oliver
It is how the results are printed respecting the
digitsargument. The default isWhy R rounds up is just the default rules in use – go to the nearest even digit. We can see this in action with
signif():which, as
?summarytells us, is what is used bysummary()and is controlled by thedigitsargument:Read
?signiffor more on the rounding issue.To get more significant digits, pass a higher number to
summary()via thedigitsargument.For example