# Load library
library(tidyverse)
install.packages("tidyverse")
# Load library
library(tidyverse)
install.packages("ggplot2")
# Load library
library(tidyverse)
install.packages("stringi")
# Load library
library(tidyverse)
# Membaca data
data <- read.csv("data_penelitian1.csv")
# Cek data
head(data)
# Pastikan kolom faktor dikonversi ke faktor (kategori)
data$Aplikasi <- factor(data$Aplikasi)
data$Komposisi <- factor(data$Komposisi)
# Model ANOVA: Komposisi tersarang dalam Aplikasi
model <- aov(Jlh_daun ~ Aplikasi + Aplikasi:Komposisi, data = data)
# Ringkasan hasil ANOVA
summary(model)
# Panggil library agricolae
library(agricolae)
install.packages("agricolae")
# Interaksi perlakuan
data$Interaksi <- interaction(data$Aplikasi, data$Komposisi)
# ANOVA dasar
anova_model <- aov(Jlh_daun ~ Interaksi, data = data)
# Uji DMRT (Duncan)
hasil_duncan <- duncan.test(anova_model, "Interaksi", group = TRUE)
# Panggil library agricolae
library(agricolae)
# Uji DMRT (Duncan)
hasil_duncan <- duncan.test(anova_model, "Interaksi", group = TRUE)
# Lihat hasil huruf
hasil_duncan$groups
# Install dan load library kalau belum
if (!require("tidyverse")) install.packages("tidyverse")
# Buat dataframe
jumlah_daun <- data.frame(
Aplikasi = factor(rep(c(10, 20, 30), each = 4)),
Komposisi = factor(rep(c(0, 20, 40, 60), times = 3)),
Mean = c(6.043, 7.753, 8.800, 9.817,
6.760, 8.963, 10.033, 10.810,
7.937, 9.797, 11.240, 12.900),
SE = c(0.537, 0.397, 0.188, 0.249,
0.181, 0.518, 0.102, 0.364,
0.140, 0.489, 0.419, 0.459)
)
# Plot grafik
ggplot(jumlah_daun, aes(x = Komposisi, y = Mean, group = Aplikasi, color = Aplikasi)) +
geom_line(size = 1) +
geom_point(size = 3) +
geom_errorbar(aes(ymin = Mean - SE, ymax = Mean + SE), width = 2) +
labs(title = "Grafik Pertumbuhan Jumlah Daun",
x = "Kandungan Biochar (%)",
y = "Jumlah Daun (Mean ± SE)") +
theme_minimal() +
theme(text = element_text(size = 14))
# 1. Pastikan semua paket sudah siap
if (!require("tidyverse")) install.packages("tidyverse")
library(tidyverse)
# 2. Masukkan data untuk jumlah daun
jumlah_daun <- tribble(
~Aplikasi, ~Komposisi, ~Mean, ~SE,
"10", "0", 6.043, 0.537,
"10", "20", 7.753, 0.397,
"10", "40", 8.800, 0.188,
"10", "60", 9.817, 0.249,
"20", "0", 6.760, 0.181,
"20", "20", 8.963, 0.518,
"20", "40", 10.033, 0.102,
"20", "60", 10.810, 0.364,
"30", "0", 7.937, 0.140,
"30", "20", 9.797, 0.489,
"30", "40", 11.240, 0.419,
"30", "60", 12.900, 0.459
) %>% mutate(Parameter = "Leaf Number")
# 3. Masukkan data untuk jumlah anakan
jumlah_anakan <- tribble(
~Aplikasi, ~Komposisi, ~Mean, ~SE,
"10", "0", 1.989, 0.071,
"10", "20", 2.427, 0.091,
"10", "40", 2.863, 0.018,
"10", "60", 2.997, 0.011,
"20", "0", 2.122, 0.074,
"20", "20", 2.883, 0.064,
"20", "40", 3.108, 0.092,
"20", "60", 3.401, 0.101,
"30", "0", 2.484, 0.027,
"30", "20", 3.132, 0.089,
"30", "40", 3.401, 0.122,
"30", "60", 3.791, 0.050
) %>% mutate(Parameter = "Tiller Number")
# 4. Masukkan data untuk tinggi tanaman
tinggi_tanaman <- tribble(
~Aplikasi, ~Komposisi, ~Mean, ~SE,
"10", "0", 41.439, 0.484,
"10", "20", 43.574, 1.991,
"10", "40", 51.438, 0.378,
"10", "60", 54.525, 0.756,
"20", "0", 45.767, 0.697,
"20", "20", 49.976, 0.875,
"20", "40", 55.343, 0.171,
"20", "60", 59.821, 0.331,
"30", "0", 51.302, 0.902,
"30", "20", 55.310, 0.524,
"30", "40", 58.714, 0.465,
"30", "60", 61.875, 0.622
) %>% mutate(Parameter = "Plant Height")
# 5. Gabungkan semua data
gabung_data <- bind_rows(jumlah_daun, jumlah_anakan, tinggi_tanaman)
# 6. Buat grafik faceted
ggplot(gabung_data, aes(x = Komposisi, y = Mean, group = Aplikasi, color = Aplikasi)) +
geom_line(size = 1.2) +
geom_point(size = 3) +
geom_errorbar(aes(ymin = Mean - SE, ymax = Mean + SE), width = 0.2) +
facet_wrap(~Parameter, scales = "free_y") +
labs(
title = "Growth Parameters of *Pennisetum purpureum* cv. Mott",
x = "Biochar Composition (%)",
y = "Mean ± SE",
color = "Application Rate (t/ha)"
) +
theme_minimal(base_size = 14)
# 6. Buat grafik faceted
ggplot(gabung_data, aes(x = Komposisi, y = Mean, group = Aplikasi, color = Aplikasi)) +
geom_line(size = 1.2) +
geom_point(size = 3) +
geom_errorbar(aes(ymin = Mean - SE, ymax = Mean + SE), width = 0.2) +
facet_wrap(~Parameter, scales = "free_y", ncol = 1) +  # Layout vertikal, 1 kolom
labs(
title = "Growth Parameters of *Pennisetum purpureum* cv. Mott",
x = "Biochar Composition (%)",
y = "Mean ± SE",
color = expression("Application Rate (ton ha"^{-1}*")")
) +
theme_minimal(base_size = 14) +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
# 6. Buat grafik faceted
ggplot(gabung_data, aes(x = Komposisi, y = Mean, group = Aplikasi, color = Aplikasi)) +
geom_line(size = 1) +
geom_point(size = 2.5) +
geom_errorbar(aes(ymin = Mean - SE, ymax = Mean + SE), width = 0.2) +
facet_wrap(~Parameter, scales = "free_y", ncol = 1) +
labs(
title = "Growth Parameters of *Pennisetum purpureum* cv. Mott",
x = "Biochar Composition (%)",
y = "Mean ± SE",
color = expression("Application Rate (ton ha"^{-1}*")")
) +
theme_minimal(base_size = 10, base_family = "Times") +
theme(
legend.position = c(0.85, 0.85),  # posisi legenda (pojok kanan atas)
legend.title = element_text(size = 10),
legend.text = element_text(size = 10),
axis.title = element_text(size = 10),
axis.text = element_text(size = 9),
strip.text = element_text(size = 10),
plot.title = element_text(size = 11, face = "bold", hjust = 0.5),
axis.text.x = element_text(angle = 0, hjust = 0.5)
)
# 6. Buat grafik faceted
ggplot(gabung_data, aes(x = Komposisi, y = Mean, group = Aplikasi, color = Aplikasi)) +
geom_line(size = 1) +
geom_point(size = 2.5) +
geom_errorbar(aes(ymin = Mean - SE, ymax = Mean + SE), width = 0.2) +
facet_wrap(~Parameter, scales = "free_y", ncol = 1) +
labs(
title = expression("Growth Parameters of " * italic("Pennisetum purpureum") * " cv. Mott"),
x = "Biochar Composition (%)",
y = "Mean ± SE",
color = expression("Application Rate (ton ha"^{-1}*")")
) +
theme_minimal(base_size = 10, base_family = "Times") +
theme(
legend.position = c(0.85, 0.15),  # POJOK KANAN BAWAH
legend.title = element_text(size = 10),
legend.text = element_text(size = 10),
axis.title = element_text(size = 10),
axis.text = element_text(size = 9),
strip.text = element_text(size = 10),
plot.title = element_text(size = 11, face = "bold", hjust = 0.5),
axis.text.x = element_text(angle = 0, hjust = 0.5)
)
# 1. Pastikan semua paket sudah siap
if (!require("tidyverse")) install.packages("tidyverse")
library(tidyverse)
library(ggplot2)
# 2. Masukkan data untuk jumlah daun
jumlah_daun <- tribble(
~Aplikasi, ~Komposisi, ~Mean, ~SE,
"10", "0", 6.043, 0.537,
"10", "20", 7.753, 0.397,
"10", "40", 8.800, 0.188,
"10", "60", 9.817, 0.249,
"20", "0", 6.760, 0.181,
"20", "20", 8.963, 0.518,
"20", "40", 10.033, 0.102,
"20", "60", 10.810, 0.364,
"30", "0", 7.937, 0.140,
"30", "20", 9.797, 0.489,
"30", "40", 11.240, 0.419,
"30", "60", 12.900, 0.459
) %>% mutate(Parameter = "Leaf Number")
# 3. Masukkan data untuk jumlah anakan
jumlah_anakan <- tribble(
~Aplikasi, ~Komposisi, ~Mean, ~SE,
"10", "0", 1.989, 0.071,
"10", "20", 2.427, 0.091,
"10", "40", 2.863, 0.018,
"10", "60", 2.997, 0.011,
"20", "0", 2.122, 0.074,
"20", "20", 2.883, 0.064,
"20", "40", 3.108, 0.092,
"20", "60", 3.401, 0.101,
"30", "0", 2.484, 0.027,
"30", "20", 3.132, 0.089,
"30", "40", 3.401, 0.122,
"30", "60", 3.791, 0.050
) %>% mutate(Parameter = "Tiller Number")
# 4. Masukkan data untuk tinggi tanaman
tinggi_tanaman <- tribble(
~Aplikasi, ~Komposisi, ~Mean, ~SE,
"10", "0", 41.439, 0.484,
"10", "20", 43.574, 1.991,
"10", "40", 51.438, 0.378,
"10", "60", 54.525, 0.756,
"20", "0", 45.767, 0.697,
"20", "20", 49.976, 0.875,
"20", "40", 55.343, 0.171,
"20", "60", 59.821, 0.331,
"30", "0", 51.302, 0.902,
"30", "20", 55.310, 0.524,
"30", "40", 58.714, 0.465,
"30", "60", 61.875, 0.622
) %>% mutate(Parameter = "Plant Height")
# 5. Gabungkan semua data
gabung_data <- bind_rows(jumlah_daun, jumlah_anakan, tinggi_tanaman)
# 6. Buat grafik faceted
ggplot(gabung_data, aes(x = Komposisi, y = Mean, group = Aplikasi, color = Aplikasi)) +
geom_line(size = 1) +
geom_point(size = 2.5) +
geom_errorbar(aes(ymin = Mean - SE, ymax = Mean + SE), width = 0.2) +
facet_wrap(~Parameter, scales = "free_y", ncol = 1) +
labs(
title = expression("Growth Parameters of " * italic("Pennisetum purpureum") * " cv. Mott"),
x = "Biochar Composition (%)",
y = "Mean ± SE",
color = expression("Application Rate (ton ha"^{-1}*")")
) +
theme_minimal(base_size = 10, base_family = "Times") +
theme(
legend.position = "right",  # legenda DI LUAR grafik
legend.title = element_text(size = 9),
legend.text = element_text(size = 8),
axis.title = element_text(size = 10),
axis.text = element_text(size = 9),
strip.text = element_text(size = 10),
plot.title = element_text(size = 11, face = "bold", hjust = 0.5),
axis.text.x = element_text(angle = 0, hjust = 0.5)
)
# 1. Pastikan semua paket sudah siap
if (!require("tidyverse")) install.packages("tidyverse")
library(tidyverse)
library(ggplot2)
# 2. Masukkan data untuk jumlah daun
jumlah_daun <- tribble(
~Aplikasi, ~Komposisi, ~Mean, ~SE,
"10", "0", 6.043, 0.537,
"10", "20", 7.753, 0.397,
"10", "40", 8.800, 0.188,
"10", "60", 9.817, 0.249,
"20", "0", 6.760, 0.181,
"20", "20", 8.963, 0.518,
"20", "40", 10.033, 0.102,
"20", "60", 10.810, 0.364,
"30", "0", 7.937, 0.140,
"30", "20", 9.797, 0.489,
"30", "40", 11.240, 0.419,
"30", "60", 12.900, 0.459
) %>% mutate(Parameter = "Leaf Number")
# 3. Masukkan data untuk jumlah anakan
jumlah_anakan <- tribble(
~Aplikasi, ~Komposisi, ~Mean, ~SE,
"10", "0", 1.989, 0.071,
"10", "20", 2.427, 0.091,
"10", "40", 2.863, 0.018,
"10", "60", 2.997, 0.011,
"20", "0", 2.122, 0.074,
"20", "20", 2.883, 0.064,
"20", "40", 3.108, 0.092,
"20", "60", 3.401, 0.101,
"30", "0", 2.484, 0.027,
"30", "20", 3.132, 0.089,
"30", "40", 3.401, 0.122,
"30", "60", 3.791, 0.050
) %>% mutate(Parameter = "Tiller Number")
# 4. Masukkan data untuk tinggi tanaman
tinggi_tanaman <- tribble(
~Aplikasi, ~Komposisi, ~Mean, ~SE,
"10", "0", 41.439, 0.484,
"10", "20", 43.574, 1.991,
"10", "40", 51.438, 0.378,
"10", "60", 54.525, 0.756,
"20", "0", 45.767, 0.697,
"20", "20", 49.976, 0.875,
"20", "40", 55.343, 0.171,
"20", "60", 59.821, 0.331,
"30", "0", 51.302, 0.902,
"30", "20", 55.310, 0.524,
"30", "40", 58.714, 0.465,
"30", "60", 61.875, 0.622
) %>% mutate(Parameter = "Plant Height")
# 5. Gabungkan semua data
gabung_data <- bind_rows(jumlah_daun, jumlah_anakan, tinggi_tanaman)
# 6. Buat grafik faceted
ggplot(gabung_data, aes(x = Komposisi, y = Mean, group = Aplikasi, color = Aplikasi)) +
geom_line(size = 1) +
geom_point(size = 2.5) +
geom_errorbar(aes(ymin = Mean - SE, ymax = Mean + SE), width = 0.2) +
facet_wrap(~Parameter, scales = "free_y", ncol = 1) +
labs(
title = expression("Growth Parameters of " * italic("Pennisetum purpureum") * " cv. Mott"),
x = "Biochar Composition (%)",
y = "Mean ± SE",
color = expression("Application Rate (tonnes ha"^{-1}*")")
) +
theme_minimal(base_size = 10, base_family = "Times") +
theme(
legend.position = "right",  # legenda DI LUAR grafik
legend.title = element_text(size = 9),
legend.text = element_text(size = 8),
axis.title = element_text(size = 10),
axis.text = element_text(size = 9),
strip.text = element_text(size = 10),
plot.title = element_text(size = 11, face = "bold", hjust = 0.5),
axis.text.x = element_text(angle = 0, hjust = 0.5)
)
