# Tính độ lệch chuẩn của Sepal.Length theo từng nhóm Species
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
sd_sepal <- iris %>%
  group_by(Species) %>%
  summarise(
    SD_Sepal_Length = sd(Sepal.Length)
  )

sd_sepal
## # A tibble: 3 × 2
##   Species    SD_Sepal_Length
##   <fct>                <dbl>
## 1 setosa               0.352
## 2 versicolor           0.516
## 3 virginica            0.636
library(ggplot2)

#  Vẽ biểu đồ violin của Petal.Width theo từng nhóm Species bằng ggplot2
ggplot(iris, aes(x = Species, y = Petal.Width, fill = Species)) +
  geom_violin(trim = FALSE) +
  labs(
    title = "Biểu đồ violin của Petal.Width theo Species",
    x = "Loài hoa (Species)",
    y = "Petal Width"
  ) +
  theme_minimal()