list.files()
## [1] "~$Data Excel.xlsx"
## [2] "~$ta untuk olah r studio.docx"
## [3] "Data Excel.xlsx"
## [4] "data untuk olah r studio.docx"
## [5] "kode-R-grafik.docx"
## [6] "kode-R-grafik.Rmd"
## [7] "kode R grafik.nb.html"
## [8] "kode R grafik.Rmd"
## [9] "WhatsApp Image 2022-12-17 at 15.54.06.jpeg"
library(readxl)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.2.2
dat <- readxl::read_excel("Data Excel.xlsx")
dat <- as.data.frame(dat)
dat
#Grafik DTS
kel <- dat[,1]
angka = dat[,"DTS"]
std = sd(angka)
ggplot(data = NULL,
aes(x = kel,
y = angka, fill = kel)) +
geom_bar(stat="identity", position=position_dodge()) +
geom_errorbar(aes(ymin = angka - 2*std, ymax = angka + 2*std), width=.2,
position=position_dodge(.9)) +
xlab("Perlakuan") + ylab("DTS") +
guides(fill=guide_legend(title="Kelompok")) +
geom_text(aes(label = angka), vjust = 5, size = 4)
#Grafik TEG
kel <- dat[,1]
angka = dat[,"TEG"]
std = sd(angka)
ggplot(data = NULL,
aes(x = kel,
y = angka, fill = kel)) +
geom_bar(stat="identity", position=position_dodge()) +
geom_errorbar(aes(ymin = angka - 2*std, ymax = angka + 2*std), width=.2,
position=position_dodge(.9)) +
xlab("Perlakuan") + ylab("TEG") +
guides(fill=guide_legend(title="Kelompok"))+
geom_text(aes(label = angka), vjust = 5, size = 4)
#Grafik Motilitas
kel <- dat[,1]
angka = dat[,"Motilitas"]
std = sd(angka)
ggplot(data = NULL,
aes(x = kel,
y = angka, fill = kel)) +
geom_bar(stat="identity", position=position_dodge()) +
geom_errorbar(aes(ymin = angka - 0.5*std, ymax = angka + 0.5*std), width=.2,
position=position_dodge(.9)) +
xlab("Perlakuan") + ylab("Motilitas") +
guides(fill=guide_legend(title="Kelompok"))+
geom_text(aes(label = angka), vjust = 5, size = 4)
#Grafik Viabilitas
kel <- dat[,1]
angka = dat[,"Viabilitas"]
std = sd(angka)
ggplot(data = NULL,
aes(x = kel,
y = angka, fill = kel)) +
geom_bar(stat="identity", position=position_dodge()) +
geom_errorbar(aes(ymin = angka - 0.5*std, ymax = angka + 0.5*std), width=.2,
position=position_dodge(.9)) +
xlab("Perlakuan") + ylab("Viabilitas") +
guides(fill=guide_legend(title="Kelompok"))+
geom_text(aes(label = angka), vjust = 5, size = 4)
#Grafik Konsentrasi
kel <- dat[,1]
angka = dat[,"Konsentrasi"]
std = sd(angka)
ggplot(data = NULL,
aes(x = kel,
y = angka, fill = kel)) +
geom_bar(stat="identity", position=position_dodge()) +
geom_errorbar(aes(ymin = angka - 0.5*std, ymax = angka + 0.5*std), width=.2,
position=position_dodge(.9)) +
xlab("Perlakuan") + ylab("Konsentrasi") +
guides(fill=guide_legend(title="Kelompok"))+
geom_text(aes(label = angka), vjust = 5, size = 4)
#Grafik Abnormalitas
kel <- dat[,1]
angka = dat[,"Abnormalitas"]
std = sd(angka)
ggplot(data = NULL,
aes(x = kel,
y = angka, fill = kel)) +
geom_bar(stat="identity", position=position_dodge()) +
geom_errorbar(aes(ymin = angka - 0.2*std, ymax = angka + 0.2*std), width=.2,
position=position_dodge(.9)) +
xlab("Perlakuan") + ylab("Abnormalitas") +
guides(fill=guide_legend(title="Kelompok"))+
geom_text(aes(label = angka), vjust = 3, size = 4)
#Grafik Bobot Testis
kel <- dat[,1]
angka = dat[,"Bobot Testis"]
std = sd(angka)
ggplot(data = NULL,
aes(x = kel,
y = angka, fill = kel)) +
geom_bar(stat="identity", position=position_dodge()) +
geom_errorbar(aes(ymin = angka - 0.5*std, ymax = angka + 0.5*std), width=.2,
position=position_dodge(.9)) +
xlab("Perlakuan") + ylab("Bobot Testis") +
guides(fill=guide_legend(title="Kelompok"))+
geom_text(aes(label = angka), vjust = 3, size = 4)
#Grafik Spermatogonia
kel <- dat[,1]
angka = dat[,"Spermatogonia"]
std = sd(angka)
ggplot(data = NULL,
aes(x = kel,
y = angka, fill = kel)) +
geom_bar(stat="identity", position=position_dodge()) +
geom_errorbar(aes(ymin = angka - 0.5*std, ymax = angka + 0.5*std), width=.2,
position=position_dodge(.9)) +
xlab("Perlakuan") + ylab("Spermatogonia") +
guides(fill=guide_legend(title="Kelompok"))+
geom_text(aes(label = angka), vjust = 3, size = 4)
#Grafik Spermatosit
kel <- dat[,1]
angka = dat[,"Spermatosit"]
std = sd(angka)
ggplot(data = NULL,
aes(x = kel,
y = angka, fill = kel)) +
geom_bar(stat="identity", position=position_dodge()) +
geom_errorbar(aes(ymin = angka - 0.5*std, ymax = angka + 0.5*std), width=.2,
position=position_dodge(.9)) +
xlab("Perlakuan") + ylab("Spermatosit") +
guides(fill=guide_legend(title="Kelompok"))+
geom_text(aes(label = angka), vjust = 3, size = 4)
#Grafik Spermatid
kel <- dat[,1]
angka = dat[,"Spermatid"]
std = sd(angka)
ggplot(data = NULL,
aes(x = kel,
y = angka, fill = kel)) +
geom_bar(stat="identity", position=position_dodge()) +
geom_errorbar(aes(ymin = angka - 0.5*std, ymax = angka + 0.5*std), width=.2,
position=position_dodge(.9)) +
xlab("Perlakuan") + ylab("Spermatid") +
guides(fill=guide_legend(title="Kelompok"))+
geom_text(aes(label = angka), vjust = 4, size = 4)