Created
March 17, 2019 18:10
-
-
Save tylerlittlefield/701d52c25f277764806695f28b5092a8 to your computer and use it in GitHub Desktop.
Look at RVerbalExpressions Structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
funcs <- ls("package:RVerbalExpressions") | |
df <- enframe(funcs, NULL, "func") %>% | |
mutate( | |
type = case_when( | |
func == "%>%" ~ "utility", | |
func == "rx" ~ "utility", | |
func == "rx_alpha" ~ "character class", | |
func == "rx_alpha_num" ~ "character class", | |
func == "rx_alphanum" ~ "character class", | |
func == "rx_anything" ~ "friendly expression", | |
func == "rx_anything_but" ~ "expression", | |
func == "rx_avoid_prefix" ~ "lookaround", | |
func == "rx_avoid_suffix" ~ "lookaround", | |
func == "rx_begin_capture" ~ "capturing group", | |
func == "rx_br" ~ "character class", | |
func == "rx_count" ~ "quantifier", | |
func == "rx_digit" ~ "character class", | |
func == "rx_end_capture" ~ "capturing group", | |
func == "rx_end_of_line" ~ "anchor", | |
func == "rx_find" ~ "expression", | |
func == "rx_line_break" ~ "character class", | |
func == "rx_lowercase" ~ "character class", | |
func == "rx_maybe" ~ "expression", | |
func == "rx_none_or_more" ~ "quantifier", | |
func == "rx_one_of" ~ "expression", | |
func == "rx_one_or_more" ~ "quantifier", | |
func == "rx_or" ~ "expression", | |
func == "rx_punctuation" ~ "character class", | |
func == "rx_range" ~ "expression", | |
func == "rx_seek_prefix" ~ "lookaround", | |
func == "rx_seek_suffix" ~ "lookaround", | |
func == "rx_something" ~ "friendly expression", | |
func == "rx_something_but" ~ "expression", | |
func == "rx_space" ~ "character class", | |
func == "rx_start_of_line" ~ "anchor", | |
func == "rx_tab" ~ "character class", | |
func == "rx_test" ~ "utility", | |
func == "rx_uppercase" ~ "character class", | |
func == "rx_whitespace" ~ "character class", | |
func == "rx_with_any_case" ~ "modifier", | |
func == "rx_word" ~ "character class", | |
func == "rx_word_char" ~ "character class", | |
func == "rx_word_edge" ~ "anchor", | |
func == "sanitize" ~ "utility", | |
TRUE ~ NA_character_ | |
) | |
) %>% | |
arrange(type) | |
args <- sapply(df$func, formalArgs) %>% | |
sapply(., paste0, collapse = ", ") %>% | |
enframe("func", "args") %>% | |
mutate(args = if_else(args == "", NA_character_, args)) | |
left_join(df, args) %>% | |
print(n = Inf) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment