使用命令在R中的最大值不同

Ohu*_*nen 3 r max unique-values distinct-values

我有以下R代码:

 library(ggplot2)
 data(diamonds)
 by(diamonds$price, diamonds$cut, summary)
 by(diamonds$price, diamonds$cut, max)
Run Code Online (Sandbox Code Playgroud)

这给了我:

diamonds$cut: Fair
Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
337    2050    3282    4359    5206   18570 
---------------------------------------------- 
  diamonds$cut: Good
Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
327    1145    3050    3929    5028   18790 
---------------------------------------------- 
  diamonds$cut: Very Good
Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
336     912    2648    3982    5373   18820 
---------------------------------------------- 
  diamonds$cut: Premium
Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
326    1046    3185    4584    6296   18820 
---------------------------------------------- 
  diamonds$cut: Ideal
Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
326     878    1810    3458    4678   18810 

diamonds$cut: Fair
[1] 18574
---------------------------------------------- 
  diamonds$cut: Good
[1] 18788
---------------------------------------------- 
  diamonds$cut: Very Good
[1] 18818
---------------------------------------------- 
  diamonds$cut: Premium
[1] 18823
---------------------------------------------- 
  diamonds$cut: Ideal
[1] 18806
Run Code Online (Sandbox Code Playgroud)

我不明白为什么这两个表中的最大值不同.最大值不应该相同吗?

s.b*_*nel 5

这是数字参数 ?summary

by(diamonds$price, diamonds$cut, function(x) summary(x, digits = 10   ))`
Run Code Online (Sandbox Code Playgroud)

与最大值相同