generated from jtr13/cctemplate
-
Notifications
You must be signed in to change notification settings - Fork 139
/
data_visualization_r_shiny.Rmd
77 lines (55 loc) · 1.91 KB
/
data_visualization_r_shiny.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Building a Dashboard in R for Data Analysis and Visualization using shiny package
Srividya Inampudi
```{r include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
I have written a blog on medium regarding the shiny package in R for my Community Contribution assignment. Please find the link attached below
link: https://medium.com/@isrivi/building-a-dashboard-in-r-for-data-analysis-and-visualization-using-shiny-package-5d864732563f
This Blog will go through the basic steps of creating a Dashboard using shiny package in R. This Dashboard can be used to Visualize and Analyze different Datasets.
```{r, include=FALSE}
#R file to run the application
#install.packages("shiny")
#install.packages("shinydashboard")
library(shiny)
library(shinydashboard)
#install.packages("DT")
library(DT)
#install.packages("shinythemes")
library(shinythemes)
ui <- dashboardPage(
dashboardHeader(title = "Datasets"),
dashboardSidebar(
sidebarMenu(
menuItem("Iris", tabName = "iris", icon = icon("tree")),
menuItem("Cars", tabName = "cars", icon = icon("car"))
)
),
dashboardBody(
tabItems(
tabItem("iris",
box(plotOutput("correlation_plot"), width = 6),
box(
selectInput("features", "Features:",
c("Sepal.Width", "Petal.length", "Petal.Width")), width = 4
)
),
tabItem("cars",
fluidPage( theme = shinytheme("journal"),
h1("Cars Dataset"),
dataTableOutput("cars_table")
)
)
)
)
)
server <- function(input, output){
output$correlation_plot <- renderPlot({
output$correlation_plot <- renderPlot({
plot(iris$Sepal.Length, iris[[input$features]],
xlab = "Sepal length", ylab = "Features")
})
})
output$cars_table <- renderDataTable(mtcars)
}
shinyApp(ui, server)
```