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
iris %>%
group_by(Species) %>%
summarise(
mean_Petal_Length = mean(Petal.Length),
sd_Petal_Length = sd(Petal.Length),
max_Petal_Length = max(Petal.Length)
)
## # A tibble: 3 × 4
## Species mean_Petal_Length sd_Petal_Length max_Petal_Length
## <fct> <dbl> <dbl> <dbl>
## 1 setosa 1.46 0.174 1.9
## 2 versicolor 4.26 0.470 5.1
## 3 virginica 5.55 0.552 6.9
library(ggplot2)
ggplot(iris, aes(x = Species, y = Sepal.Width, fill = Species)) +
geom_violin(trim = FALSE) +
labs(
title = "Biểu đồ violin của Sepal.Width theo Species",
x = "Species",
y = "Sepal.Width"
) +
theme_minimal()
