@@ -10,36 +10,59 @@ ui <- page_sidebar(
1010 # Sidebar panel for inputs ----
1111 sidebar = sidebar(
1212
13- # Input: Simple integer interval ----
14- sliderInput(" integer" , " Integer:" ,
15- min = 0 , max = 1000 ,
16- value = 500 ),
17-
18- # Input: Decimal interval with step value ----
19- sliderInput(" decimal" , " Decimal:" ,
20- min = 0 , max = 1 ,
21- value = 0.5 , step = 0.1 ),
22-
23- # Input: Specification of range within an interval ----
24- sliderInput(" range" , " Range:" ,
25- min = 1 , max = 1000 ,
26- value = c(200 ,500 )),
27-
28- # Input: Custom currency format for with basic animation ----
29- sliderInput(" format" , " Custom Format:" ,
30- min = 0 , max = 10000 ,
31- value = 0 , step = 2500 ,
32- pre = " $" , sep = " ," ,
33- animate = TRUE ),
34-
35- # Input: Animation with custom interval (in ms) ----
36- # to control speed, plus looping
37- sliderInput(" animation" , " Looping Animation:" ,
38- min = 1 , max = 2000 ,
39- value = 1 , step = 10 ,
40- animate =
41- animationOptions(interval = 300 , loop = TRUE ))
42-
13+ # Input: Simple integer interval ----
14+ sliderInput(
15+ " integer" ,
16+ " Integer:" ,
17+ min = 0 ,
18+ max = 1000 ,
19+ value = 500
20+ ),
21+
22+ # Input: Decimal interval with step value ----
23+ sliderInput(
24+ " decimal" ,
25+ " Decimal:" ,
26+ min = 0 ,
27+ max = 1 ,
28+ value = 0.5 ,
29+ step = 0.1
30+ ),
31+
32+ # Input: Specification of range within an interval ----
33+ sliderInput(
34+ " range" ,
35+ " Range:" ,
36+ min = 1 ,
37+ max = 1000 ,
38+ value = c(200 , 500 )
39+ ),
40+
41+ # Input: Custom currency format for with basic animation ----
42+ sliderInput(
43+ " format" ,
44+ " Custom Format:" ,
45+ min = 0 ,
46+ max = 10000 ,
47+ value = 0 ,
48+ step = 2500 ,
49+ pre = " $" ,
50+ sep = " ," ,
51+ animate = TRUE
52+ ),
53+
54+ # Input: Animation with custom interval (in ms) ----
55+ # to control speed, plus looping
56+ sliderInput(
57+ " animation" ,
58+ " Looping Animation:" ,
59+ min = 1 ,
60+ max = 2000 ,
61+ value = 1 ,
62+ step = 10 ,
63+ animate =
64+ animationOptions(interval = 300 , loop = TRUE )
65+ )
4366 ),
4467
4568 # Output: Table summarizing the values entered ----
@@ -51,27 +74,29 @@ server <- function(input, output) {
5174
5275 # Reactive expression to create data frame of all input values ----
5376 sliderValues <- reactive({
54-
5577 data.frame (
56- Name = c(" Integer" ,
57- " Decimal" ,
58- " Range" ,
59- " Custom Format" ,
60- " Animation" ),
61- Value = as.character(c(input $ integer ,
62- input $ decimal ,
63- paste(input $ range , collapse = " " ),
64- input $ format ,
65- input $ animation )),
66- stringsAsFactors = FALSE )
67-
78+ Name = c(
79+ " Integer" ,
80+ " Decimal" ,
81+ " Range" ,
82+ " Custom Format" ,
83+ " Animation"
84+ ),
85+ Value = as.character(c(
86+ input $ integer ,
87+ input $ decimal ,
88+ paste(input $ range , collapse = " " ),
89+ input $ format ,
90+ input $ animation
91+ )),
92+ stringsAsFactors = FALSE
93+ )
6894 })
6995
7096 # Show the values in an HTML table ----
7197 output $ values <- renderTable({
7298 sliderValues()
7399 })
74-
75100}
76101
77102# Create Shiny app ----
0 commit comments