Title: | Navigation Menu for Pipe-Friendly Data Processing |
---|---|
Description: | Provides a navigation menu to enable pipe-friendly data processing for hierarchical data structures. By activating the menu items, you can perform operations on each item while maintaining the overall structure in attributes. |
Authors: | Mizuki Uchida [aut, cre] |
Maintainer: | Mizuki Uchida <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.1 |
Built: | 2024-11-10 03:29:12 UTC |
Source: | https://github.com/uchidamizuki/navigatr |
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)
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)
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)
Set items
itemise(.data, ...) itemize(.data, ...)
itemise(.data, ...) itemize(.data, ...)
.data |
A |
... |
Key-value pairs. |
A navigatr_nav_input
object.
Rename key names
rekey(.data, ...) ## S3 method for class 'navigatr_nav' rekey(.data, ...) ## S3 method for class 'navigatr_item' rekey(.data, ...) rekey_with(.data, .fn, .keys = tidyselect::everything(), ...)
rekey(.data, ...) ## S3 method for class 'navigatr_nav' rekey(.data, ...) ## S3 method for class 'navigatr_item' rekey(.data, ...) rekey_with(.data, .fn, .keys = tidyselect::everything(), ...)
.data |
For |
... |
For |
.fn |
A function used to transform the selected |
.keys |
Keys to rename; defaults to all keys. |
A navigatr_nav
or navigatr_item
object.