library(readr)
library(ggstatsplot)
## You can cite this package as:
## Patil, I. (2021). Visualizations with statistical details: The 'ggstatsplot' approach.
## Journal of Open Source Software, 6(61), 3167, doi:10.21105/joss.03167
bid <- "https://raw.githubusercontent.com/ngocdlu/data_analysis/main/bidoupensis.csv"
bid <- read_csv(bid)
## `curl` package not installed, falling back to using `url()`
## Rows: 65 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): species
## dbl (5): pet, len, wid, rat, cir
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(bid)
## # A tibble: 6 × 6
## pet len wid rat cir species
## <dbl> <dbl> <dbl> <dbl> <dbl> <chr>
## 1 0.61 11.0 5.21 2.12 0.75 bidoupensis
## 2 0.58 11.6 5.03 2.3 0.74 bidoupensis
## 3 0.35 9.1 3.72 2.45 0.64 bidoupensis
## 4 0.32 9.72 4.26 2.28 0.71 bidoupensis
## 5 0.35 8.99 4.16 2.16 0.67 bidoupensis
## 6 0.43 10.0 4.93 2.04 0.74 bidoupensis
ggbetweenstats(data = bid, x = species, y = len)
Dạng boxplot
ggbetweenstats(data = bid, x = species, y = len, plot.type = "box")
Dạng violin
ggbetweenstats(data = bid, x = species, y = len, plot.type = "violin")
Dạng lai: boxviolin
ggbetweenstats(data = bid, x = species, y = len, plot.type = "boxviolin")
ggbetweenstats(data = bid, x = species, y = len, plot.type = "box", p.adjust.method = "BH")
ggbetweenstats(data = bid, x = species, y = len, plot.type = "box", title = "Biểu đồ so sánh chiều dài phiến lá", xlab = "Loài thực vật", ylab = "Chiều dài phiến lá (cm)")
Tài liệu tham khảo