Session Ready
Exercise

Create reactive menu items

We have added dynamic content via subsetting a data frame based on using input and reading in real-time data. Now we are going to allow the user to input task_data to determine task items. Recall that we can use an apply() function to iterate over a data frame, applying the taskItem() function to each row.

tasks <- apply(task_data, 1, function(row) { 
  taskItem(text = row[["text"]],
           value = row[["value"]])
})
dropdownMenu(type = "tasks", .list = tasks)

You have a data frame (already loaded) called task_data with columns text and value. Use this to create a task drop down menu.

Instructions
100 XP
  • Create a list of tasks called tasks from the task_data data frame, like in the code chunk provided.
  • Create the task drop down menu from your tasks list.
  • Output a reactive task menu to output$task_menu and render the newly created reactive task menu in the dashboardHeader().
  • Rerun the shiny app with these updates.