data(iris)
sepal_width_stats <- aggregate(
Sepal.Width ~ Species,
data = iris,
FUN = function(x) c(
Min = min(x),
Max = max(x),
Mean = mean(x)
)
)
print(sepal_width_stats)
## Species Sepal.Width.Min Sepal.Width.Max Sepal.Width.Mean
## 1 setosa 2.300 4.400 3.428
## 2 versicolor 2.000 3.400 2.770
## 3 virginica 2.200 3.800 2.974
boxplot(
Petal.Length ~ Species,
data = iris,
main = "Boxplot Petal.Length theo từng Species",
xlab = "Species",
ylab = "Petal.Length"
)