Step Up your Dashboard with shinydashboard: Exercises (Part-2)

September 17, 2018
By

(This article was first published on R-exercises, and kindly contributed to R-bloggers)

The shinydashboard provides a well-designed dashboard theme for Shiny apps, and allows for an easy assembly of a dashboard from a couple of basic building blocks. The package is widely used in commercial environments as well, due to its neat features for building convenient and robust layouts.

This exercise set will help you practice all of the main features of this great package. By completing the two part of the exercise series, you’ll know that you’re ready to start building well-designed Shiny apps. We will make some minimal use of the built-in dataset datasets::CO2 (specific description of the dataset are irrelevant, but you can check them out by typing ?datasets::CO2). Each exercise is adding some more features/functionalities to the code of the previous exercise, so be sure to not discard the code until after you’re done with all of the exercises. Answers to the exercises are available here.

In the solutions page, you’ll first find only the relevant component of each exercise, and then at the end of the page you will find the entire Shiny app code, that contain all of the different components together. This exercise set is based on the output code of this exercise set. If you haven’t done it, you can just use the code under “All Exercises Combined” here (at the bottom) as your basis for this exercise set.

For other parts of the series follow the tag shinydashboard

Exercise 1
In the “data” tab, add a box() with the title “CO2 Data”.
The box should have a blue header, and it should be collapsible.

Exercise 2
Add the CO2 table to the box you just created.
The table should be filtered by the plant input that was created in the previous exercise set.

Exercise 3
In the “licenses” tab, add a tabBox() that contains two panels: one titled “Data”, and one titled “Icons”.
You can leave those panels empty for now.

Exercise 4
In the “contact_us” tab, add an infoBox() with some content of your choice, and select its color and icon.

Exercise 5
In the “contact_us” tab, add an valueBox() with some content of your choice, and select its color and icon.

Exercise 6
Add a “messages” dropdown menu to the header.
Select its icon and badge-status, and add one messageItem() to it.

Exercise 7
Add a “tasks” dropdown menu to the header.
Select its icon and badge-status, and add two taskItem()s to it.

Exercise 8
Add a placeholder for a “notifications” dropdown menu in the header using dropdownMenuOutput().
The output ID of should be “notifications”.

Exercise 9
Add the server-side code of the “notifications” dropdown menu.
It should have a single notification item that shows what is the current value of the plant input that was created in the previous exercise set.

Exercise 10
Add a link to “r-exercises.com” in the header.
Hint: use tags$li(class = "dropdown", ...) together with tags$a(...).

To leave a comment for the author, please follow the link and comment on their blog: R-exercises.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)