gpt4 book ai didi

r - 通过命令使用 R 中的不同最大值

转载 作者:行者123 更新时间:2023-12-01 11:24:08 25 4
gpt4 key购买 nike

我有以下 R 代码:

 library(ggplot2)
data(diamonds)
by(diamonds$price, diamonds$cut, summary)
by(diamonds$price, diamonds$cut, max)

这给了我:

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

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

最佳答案

这是数字参数?summary

by(diamonds$price, diamonds$cut, function(x) summary(x, digits = 10   ))`

给与最大值相同

关于r - 通过命令使用 R 中的不同最大值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39149017/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com