Skip to content

Instantly share code, notes, and snippets.

@aagarw30
Created March 11, 2018 17:58
Show Gist options
  • Save aagarw30/4978bc66d88dec8997b540005c92c062 to your computer and use it in GitHub Desktop.
Save aagarw30/4978bc66d88dec8997b540005c92c062 to your computer and use it in GitHub Desktop.
3. R shinydashboard package - example - demo tabItems(), tabItem() - add tabs or pages corresponding to sidebar menu items in dashboardBody
library(shiny)
library(shinydashboard)
mydata = read.csv("Wholesale customers data.csv", stringsAsFactors = FALSE, header = TRUE)
shinyServer(function(input, output, session){
output$mydatatable <- renderDataTable({
mydata
})
}
)
## Intro shinydashboard package
## shinydashboard Basic Layout
library(shiny)
# install.packages("shinydashboard")
library(shinydashboard)
shinyUI(
dashboardPage(
dashboardHeader(title = "Demo shinydashboard package - an example", titleWidth = 600),
dashboardSidebar(
sidebarMenu(
menuItem(text = "About", tabName = "about", icon=icon("clipboard")),
menuItem("Data", tabName = "data", icon=icon("database")),
menuItem("Download", icon = icon("download")),
menuItem("Link to code files", href = "https://www.google.com", icon=icon("code"))
# https://fontawesome.com/icons?d=gallery
)
),
dashboardBody(
tabItems(
tabItem(tabName = "about", p("This example app demonstrates basic layout of R shinydashboard package.
"), p("The dataset used in this app is a wholesale customer dataset that
comes from UCI library. "), p("https://archive.ics.uci.edu/ml/datasets/wholesale+customers#"),
p("The data set is originated from a larger database referred on:
Abreu, N. (2011). Analise do perfil do cliente Recheio e desenvolvimento de um sistema promocional. Mestrado em Marketing, ISCTE-IUL, Lisbon ")),
tabItem(tabName = "data", dataTableOutput("mydatatable"))
)
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment