data(iris)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
result <- iris %>%
group_by(Species) %>%
summarise(
min_sepal_width = min(Sepal.Width),
max_sepal_width = max(Sepal.Width),
sd_sepal_width = sd(Sepal.Width)
)
print(result)
## # A tibble: 3 × 4
## Species min_sepal_width max_sepal_width sd_sepal_width
## <fct> <dbl> <dbl> <dbl>
## 1 setosa 2.3 4.4 0.379
## 2 versicolor 2 3.4 0.314
## 3 virginica 2.2 3.8 0.322
library(ggplot2)
ggplot(iris, aes(x = Species, y = Sepal.Length)) +
geom_boxplot() +
labs(
title = "Boxplot Sepal.Length theo Species",
x = "Species",
y = "Sepal.Length"
)
