Skip to content
Back to formatted view

Raw Message

Message-ID: <20030517191245.GA25200@sonny.eddelbuettel.com>
Date: 2003-05-17T19:12:45Z
From: Dirk Eddelbuettel
Subject: max/summary
In-Reply-To: <20030517184718.89660.qmail@web41205.mail.yahoo.com>

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.