[R] summary and min max
Sebastian P. Luque
spluque at gmail.com
Mon Apr 23 17:35:00 CEST 2007
Hi,
I came across a case where there's a discrepancy between minimum and
maximum values reported by 'summary' and the 'min' and 'max' functions:
---<---------------cut here---------------start-------------->---
R> str(tt)
num [1:1397] 1952 1970 1976 1967 1946 ...
R> summary(tt)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1920 1960 1970 1970 1980 2000
R> min(tt)
[1] 1918
R> max(tt)
[1] 2001
R> sessionInfo()
R version 2.5.0 beta (2007-04-12 r41139)
x86_64-pc-linux-gnu
locale:
LC_CTYPE=en_CA.UTF-8;LC_NUMERIC=C;LC_TIME=en_CA.UTF-8;LC_COLLATE=en_CA.UTF-8;LC_MONETARY=en_CA.UTF-8;LC_MESSAGES=en_CA.UTF-8;LC_PAPER=en_CA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_CA.UTF-8;LC_IDENTIFICATION=C
attached base packages:
[1] "stats" "graphics" "grDevices" "utils" "datasets" "methods"
[7] "base"
other attached packages:
lattice
"0.14-17"
---<---------------cut here---------------end---------------->---
So this is a simple numeric vector, without any NA's, so I'm not sure
what's causing the discrepancy between these functions. Any suggestions
as to what to look for welcome. Thanks.
Cheers,
--
Seb
More information about the R-help
mailing list