Parcourir la source

Gadget only shows regex functions from installed packages

Fixes #13
main
Garrick Aden-Buie il y a 5 ans
Parent
révision
7400d42340
2 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. +6
    -0
      R/gadget.R
  2. +1
    -1
      R/gadget_ui.R

+ 6
- 0
R/gadget.R Voir le fichier

@@ -110,6 +110,12 @@ regexFn_choices <- list(
)
)

available_regex_functions <- function() {
pkgs <- c("stringr", "rematch2")
has_pkg <- vapply(pkgs, requireNamespace, quietly = TRUE, logical(1))
regexFn_choices[c("base", pkgs[has_pkg])]
}

regexFn_substitute <- c(
paste0(c("", "g"), "sub"),
paste0("str_replace", c("", "_all"))

+ 1
- 1
R/gadget_ui.R Voir le fichier

@@ -137,7 +137,7 @@ regexplain_gadget_ui <- function(text = NULL, pattern = NULL, start_page = "Text
selectInput(
"regexFn",
label = "Apply Function",
choices = regexFn_choices
choices = available_regex_functions()
),
tags$span(
class = "help-block",

Chargement…
Annuler
Enregistrer