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. Thanks. Mahbub
They are the same value. Lokking at ?summary will show you that the number of significant values are different in the two cases (7 and 4). You need to distinguish between the value and how it is printed. On Sat, 17 May 2003, Mahbub Latif wrote:> 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.-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
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.