[R] max/summary
Dirk Eddelbuettel
edd at debian.org
Sat May 17 21:12:45 CEST 2003
On Sat, May 17, 2003 at 11:47:18AM -0700, Mahbub Latif wrote:
> Hi,
>
> What is the reason for getting two different max of a
> vector from two functions max() and summary()? Here is
> an example,
>
> > set.seed(2222)
> > x <- sample(x=1:100000, size=10000, replace=T)
> > max(x)
> [1] 99992
> > summary(x)
> Min. 1st Qu. Median Mean 3rd Qu. Max.
> 6 24510 49950 50020 75040 99990
>
> Which value is the correct one? I had this problem
> while I was working with microarry data.
They are both the same, summary uses a display with 4 significant digits:
edd at chibud:~> R --silent --no-save --no-restore
> set.seed(2222)
> x <- sample(x=1:100000, size=10000, replace=T)
> max(x)
[1] 99992
> summary(x, digits=6)
Min. 1st Qu. Median Mean 3rd Qu. Max.
6.0 24513.5 49954.5 50019.7 75038.8 99992.0
Hth, Dirk
--
Don't drink and derive. Alcohol and analysis don't mix.
More information about the R-help
mailing list