data(iris)
result <- aggregate(
Sepal.Width ~ Species,
data = iris,
FUN = function(x) c(
Min = min(x),
Max = max(x),
SD = sd(x)
)
)
result
##      Species Sepal.Width.Min Sepal.Width.Max Sepal.Width.SD
## 1     setosa       2.3000000       4.4000000      0.3790644
## 2 versicolor       2.0000000       3.4000000      0.3137983
## 3  virginica       2.2000000       3.8000000      0.3224966
library(ggplot2)
ggplot(data = iris, aes(x = Species, y = Sepal.Length)) +
geom_boxplot(fill = "lightpink") +
labs(
title = "Boxplot Sepal.Length theo Species",
x = "Species",
y = "Sepal.Length"
) +
theme_minimal()