This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.3
data("diamonds")
A1 <- ggplot(diamonds, aes(x = cut)) +
geom_bar(fill = "darkturquoise") +
labs(
title = "Jumlah Berlian Berdasarkan Kualitas Potongan ",
x = "Potongan Berlian",
y = "Jumlah Berlian"
) +
theme_minimal()
A1
A2 <- ggplot(diamonds, aes(x = cut, fill = color)) +
geom_bar(position = "dodge", width = 0.8) +
labs(
title = "Perbandingan Jumlah Berlian pada Setiap Kualitas Potongan",
x = "Kualitas Potongan",
y = "Jumlah Berlian",
fill = "Color"
) +
theme_minimal(base_size = 10) +
theme(
plot.title = element_text(face = "bold", size = 11, hjust = 0.5),
axis.title = element_text(face = "bold"),
legend.title = element_text(face = "bold")
)
A2
A3 <- ggplot(diamonds, aes(x = clarity, fill = color)) +
geom_bar(position = "fill") +
scale_fill_manual(values = c(
"#4E79A7","#F28E2B","#E15759","#76B7B2","#59A14F",
"#EDC948","#B07AA1"))+
scale_y_continuous(labels = scales::percent) +
labs(
title = "Proporsi Warna Berlian Berdasarkan Tingkat Kejernihan",
x = "Tingkat Kejernihan",
y = "Proporsi",
fill = "Color"
) +
theme_minimal()
A3
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.