activate | R Documentation |
Activates a menu item with the same syntax as dplyr::pull()
.
Activating a menu item allows you to perform operations on the active item.
activate()
turns a navigatr_nav_menu
object into an navigatr_item
object, and deactivate()
turns it back.
activate(.data, ..., .add = FALSE)
## S3 method for class 'navigatr_nav_menu'
activate(.data, ..., .add = FALSE)
## S3 method for class 'navigatr_item'
activate(.data, ..., .add = FALSE)
deactivate(x, ..., deep = TRUE)
## S3 method for class 'navigatr_nav_menu'
deactivate(x, ..., deep = TRUE)
## S3 method for class 'navigatr_item'
deactivate(x, ..., deep = TRUE)
.data |
A |
... |
In |
.add |
Whether to add new variables to the path indices.
If |
x |
A |
deep |
If |
In activate()
, An navigatr_item
object.
If it inherits from class navigatr_nav_menu
, the menu will be displayed
hierarchically.
Otherwise, the active data will be displayed.
In deactivate()
, A navigatr_nav_menu
object.
library(dplyr)
mn1 <- new_nav_menu(key = c("band_members", "band_instruments"),
value = list(band_members, band_instruments))
mn1 |>
activate(band_members) |>
filter(band == "Beatles")
# Items can also be specified as integers
mn1 |>
activate(2)
mn1 |>
activate(-1) |>
deactivate()
# To activate items in a nested menu, specify multiple variables
mn2 <- new_nav_menu(key = c("key1", "key2"),
value = list(mn1, mn1))
mn2 |>
activate(key1, band_members)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.