Tugas 3 MSIM43101
Tugas 3 MSIM43101
NIM : 043680846
UPBJJ : Batam
Tugas 3 MSIM4310
# Load necessary libraries
library(shiny)
library(ggplot2)
library(readxl)
# Define the UI
ui <- fluidPage(
titlePanel("Visualisasi Data Meteorologi Samarinda"),
sidebarLayout(
sidebarPanel(
selectInput("variable", "Pilih Variabel:",
choices = c("Suhu Udara (Min)" = "Temperature_Min",
"Suhu Udara (Max)" = "Temperature_Max",
"Suhu Udara (Rata-rata)" = "Temperature_Avg",
"Kelembaban" = "Relative_Humidity",
"Tekanan Udara" = "Atmospheric_Pressure",
"Kecepatan Angin" = "Wind_Velocity",
"Curah Hujan" = "Rainfall",
"Penyinaran Matahari" = "Sunshine_Duration")),
selectInput("plotType", "Pilih Jenis Plot:",
choices = c("Scatter Plot" = "scatter",
"Line Plot" = "line",
"Bar Plot" = "bar"))
),
mainPanel(
plotOutput("dataPlot"),
tableOutput("dataTable")
)
)
)
if (input$plotType == "scatter") {
gg <- gg + geom_point()
} else if (input$plotType == "line") {
gg <- gg + geom_line()
} else if (input$plotType == "bar") {
gg <- gg + geom_bar(stat = "identity")
}
gg
})