-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdropdownModule.R
More file actions
50 lines (43 loc) · 1.58 KB
/
dropdownModule.R
File metadata and controls
50 lines (43 loc) · 1.58 KB
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
# A Module for configuring user dropdown input for the dashboard
# Create dataframe for storing aesthetic album details
albumname <- c("The College Dropout","Late Registration",
"Graduation","808s & Heartbreak",
"My Beautiful Dark Twisted Fantasy", "Yeezus",
"The Life of Pablo","Ye","Jesus Is King")
sv_path <- c("the_college_dropout.jpg",
"Late_registration.jpg",
"Graduation.jpg",
"808s_Heartbreak.png",
"MBDTF.jpg",
"Yeezus.png",
"The_life_of_pablo.jpg",
"Ye.jpg",
"Jesus_Is_King.png")
album_fill <- c("#e8982e", "#633119","#b25186",
"#b72124", "#ad2110","#fe0000",
"#f58b57", "#00FF00", "#0000fe")
album_border <- c("#411218", "#7398aa", "#853082",
"#c2cece", "#ffd700", "#C0C0C0",
"#412517","#87ceeb","#ffd700")
chart_config <- data.frame(albumname,sv_path, album_fill,
album_border)
# Module UI
dropdownUI <-
function(id, lab, dataIn) {
selectInput(NS(id,"varname"), label = lab, choices = dataIn)
}
# Module server
dropdownserver <- function(input, output, session){
#Function checks what namespace id is before returning
#reactively either a df with album details or word list
return (
reactive(
if (grepl("album", session$ns("tmp"), fixed = TRUE)){
chart_config %>% filter(albumname== input$varname)
}
else{input$varname}
)
)
#print(session$ns("tmp"))
#return(reactive({session$ns}))
}