R
Shiny
Visualization
Report
資料視覺化
Reference from Building Dashboards with shinydashboard.
Learn More →
View another note on ShinyApp.
library(shinydashboard)
# create header, sidebar & body
header = dashboardHeader(...)
sidebar = dashboardSidebar(...)
body = dashboardBody(...)
ui = dashboardPage(header,sidebar,body)
server = function(input, output) {
...
}
shinyApp(ui, server)
dashboardHeader(
dropdownMenu(
type = "messages",
messageItem(
from = "Lucy",
message = "You can view the International Space Station!",
href = "https://spotthestation.nasa.gov/sightings/"
),
messageItem(
from = "Lucy",
message = "Learn more about the International Space Station",
href = "https://spotthestation.nasa.gov/faq.cfm"
)
)
)
dashboardHeader(
dropdownMenu(
type = 'notifications',
notificationItem("The International Space Station is overhead!")
)
)
dashboardHeader(
dropdownMenu(
type = 'tasks',
taskItem("Mission Learn Shiny Dashboard", 10) # progress bar
)
)
output$task_menu <- renderMenu({
tasks = apply(task_data, 1, function(row){
taskItem(text = row[['text']],
value = row[['value']])
})
dropdownMenu(type = 'tasks', .list = tasks)
View 'ShinyApp' note for the detail.
dashboardSidebar(
sidebarMenu(
menuItem(text = 'Dashboard', tabName = 'dashboard'),
menuItem(text = 'Inputs', tabName = 'inputs')
)
selectInput(...)
)
dashboardBody(
tabItems(
tabItem(
tabName = "dashboard",
tabBox(title = "International Space Station Fun Facts",
tabPanel("Fun Fact 1"),
tabPanel("Fun Fact 2")
),
tabItem(tabName = "inputs")
)
)
)
body <- dashboardBody(
fluidRow(
box(
width = 12,
title = 'Regular Box, Row 1',
subtitle = 'Star Wars',
color = 'yellow'
))
)
)
body <- dashboardBody(
fluidRow(
column(width = 6,
infoBox(
width = NULL,
title = "Regular Box, Column 1",
subtitle = "Gimme those Star Wars",
status = 'danger'
)
)
)
)
ui <- dashboardPage(
skin = 'purple',
header = dashboardHeader(),
sidebar = dashboardSidebar(),
body = dashboardBody()
)
body <- dashboardBody(
tags$head(
tags$style(HTML(
'h3 {
font-weight: bold;
}'))
)
)
icon = icon('rocket')
server = function(input, output, session) {
reactive_starwars_data = reactiveFileReader(
intervalMillis = 1000,
session = session,
filePath = starwars_url,
readFunc = function(filePath) {
read.csv(url(filePath))
}
)
output$table = renderTable({
reactive_starwars_data()
})
}
sidebar = dashboardSidebar(
actionButton("click", "Update click box")
)
server = function(input, output) {
output$click_box <- renderValueBox({
valueBox(
value = input$click, # increases in value each time the user clicks the action button.
subtitle = 'Click Box'
)
})
}
body = dashboardBody(
valueBoxOutput('click_box')
)
# Each time a new user visits your application.
server <- function(input, output) {
storms <- read.csv("starwars.csv")
}
# Optimizational way:
# Once when the application is launched.
storms <- read.csv("starwars.csv")
server <- function(input, output) {
}
Other Reference: Rpubs R Markdown Theme date: '`r Sys.Date()`' output: rmdformats::material # readthedown date: "`r Sys.Date()`" output: prettydoc::html_pretty:
Aug 3, 2022Reference: http://ccckmit.wikidot.com/st:test1 d = density function 連續型 p = cumulative distribution function 離散 q = quantile function r = random number generation # 累積的常態機率分布 pnorm(175, mean = 170, sd = 5) - pnorm(170, 170, 5) # 計算170到175中間的那塊常態分布面積(mean:170, x:175, sd:5)
Nov 1, 2021Reference: Michael Hahsler(2011). "recommenderlab: A Framework for Developing and Testing Recommendation Algorithms." 推薦系統基本觀念—Collaborative Filtering(協同式過濾) 1. User-based Collaborative Filtering(UBCF) Memory-based CF 採用「全部」或巨量的使用者資料去進行推薦→佔記憶體 推薦系統通常是在線上進行運算,因此上述特性會不利於演算速度 原理
Aug 24, 2020Reference: Ebook Dataset: 古騰堡書庫 Regex in R 尋找 符號 舉例
Jun 20, 2020or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up