| # Generated by roxygen2: do not edit by hand | # Generated by roxygen2: do not edit by hand | ||||
| export(regexplain_cheatsheet) | export(regexplain_cheatsheet) | ||||
| export(regexplain_file) | |||||
| export(regexplain_gadget) | export(regexplain_gadget) | ||||
| export(regexplain_web) | export(regexplain_web) | ||||
| export(view_regex) | export(view_regex) |
| } | } | ||||
| #' Regexplain File Addin | |||||
| #' | |||||
| #' See [regexplain_addin]. Opens file chooser to pick file, reads lines, returns | |||||
| #' first `regexplain.addin.max_lines` (default 100). | |||||
| #' | |||||
| #' @keywords internal | |||||
| regexplain_file <- function() { | |||||
| #' @describeIn regexplain_gadget Opens file chooser to pick file, reads lines, | |||||
| #' returns first `regexplain.addin.max_lines` (default 100). Used in the | |||||
| #' "Regexplain File" [regexplain_addin]. | |||||
| #' @export | |||||
| regexplain_file <- function(pattern = NULL, start_page = "RegEx") { | |||||
| fname <- file.choose() | fname <- file.choose() | ||||
| x <- readLines(fname) | x <- readLines(fname) | ||||
| max_lines <- getOption("rexeplain.addin.max_lines", 100) | max_lines <- getOption("rexeplain.addin.max_lines", 100) | ||||
| "increase the number of lines.") | "increase the number of lines.") | ||||
| x <- x[1:max_lines] | x <- x[1:max_lines] | ||||
| } | } | ||||
| regexplain_gadget(x, "RegEx") | |||||
| regexplain_gadget(text = x, pattern = pattern, start_page = start_page) | |||||
| } | } |
| #' addins. Opens the RegExplain gadget interface in an RStudio viewer | #' addins. Opens the RegExplain gadget interface in an RStudio viewer | ||||
| #' pane. | #' pane. | ||||
| #' | #' | ||||
| #' @examples | |||||
| #' \dontrun{ | |||||
| #' regexplain_gadget(text = month.name, pattern = "(Ma|Ju)|(er)") | |||||
| #' regexplain_web(text = month.name, pattern = "(Ma|Ju)|(er)") | |||||
| #' regexplain_file() | |||||
| #' } | |||||
| #' | |||||
| #' @import miniUI | #' @import miniUI | ||||
| #' @import shiny | #' @import shiny | ||||
| #' @param text Text to explore in gadget (editable using interface) | #' @param text Text to explore in gadget (editable using interface) |
| #' | #' | ||||
| #' @inheritParams shiny::textInput | #' @inheritParams shiny::textInput | ||||
| #' @param width Width of `shiny-input-container` div. | #' @param width Width of `shiny-input-container` div. | ||||
| #' @param ... Extra elements to be included in the `input-group` div. | |||||
| #' @family modified shiny inputs | #' @family modified shiny inputs | ||||
| textInputCode <- function(inputId, label, value = "", width = NULL, | textInputCode <- function(inputId, label, value = "", width = NULL, | ||||
| placeholder = NULL, ...) { | placeholder = NULL, ...) { |
| % Generated by roxygen2: do not edit by hand | |||||
| % Please edit documentation in R/addins.R | |||||
| \name{regexplain_file} | |||||
| \alias{regexplain_file} | |||||
| \title{Regexplain File Addin} | |||||
| \usage{ | |||||
| regexplain_file() | |||||
| } | |||||
| \description{ | |||||
| See \link{regexplain_addin}. Opens file chooser to pick file, reads lines, returns | |||||
| first \code{regexplain.addin.max_lines} (default 100). | |||||
| } | |||||
| \keyword{internal} |
| % Generated by roxygen2: do not edit by hand | % Generated by roxygen2: do not edit by hand | ||||
| % Please edit documentation in R/gadget.R | |||||
| \name{regexplain_gadget} | |||||
| % Please edit documentation in R/addins.R, R/gadget.R | |||||
| \name{regexplain_file} | |||||
| \alias{regexplain_file} | |||||
| \alias{regexplain_gadget} | \alias{regexplain_gadget} | ||||
| \alias{regexplain_web} | \alias{regexplain_web} | ||||
| \title{RegExplain gadget} | \title{RegExplain gadget} | ||||
| \usage{ | \usage{ | ||||
| regexplain_file(pattern = NULL, start_page = "RegEx") | |||||
| regexplain_gadget(text = NULL, pattern = NULL, start_page = if | regexplain_gadget(text = NULL, pattern = NULL, start_page = if | ||||
| (is.null(text)) "Text" else "RegEx") | (is.null(text)) "Text" else "RegEx") | ||||
| regexplain_web(text = NULL, pattern = NULL, start_page = "Text", ...) | regexplain_web(text = NULL, pattern = NULL, start_page = "Text", ...) | ||||
| } | } | ||||
| \arguments{ | \arguments{ | ||||
| \item{text}{Text to explore in gadget (editable using interface)} | |||||
| \item{pattern}{Regular Expression to edit or visualize using RegExplain} | \item{pattern}{Regular Expression to edit or visualize using RegExplain} | ||||
| \item{start_page}{Open gadget to this tab, one of \code{"Text"}, \code{"RegEx"}, | \item{start_page}{Open gadget to this tab, one of \code{"Text"}, \code{"RegEx"}, | ||||
| \code{"Output"}, or \code{"Help"}} | \code{"Output"}, or \code{"Help"}} | ||||
| \item{text}{Text to explore in gadget (editable using interface)} | |||||
| \item{...}{Arguments passed on to \code{shiny::shinyApp} | \item{...}{Arguments passed on to \code{shiny::shinyApp} | ||||
| \describe{ | \describe{ | ||||
| \item{ui}{The UI definition of the app (for example, a call to | \item{ui}{The UI definition of the app (for example, a call to | ||||
| } | } | ||||
| \section{Functions}{ | \section{Functions}{ | ||||
| \itemize{ | \itemize{ | ||||
| \item \code{regexplain_file}: Opens file chooser to pick file, reads lines, | |||||
| returns first \code{regexplain.addin.max_lines} (default 100). Used in the | |||||
| "Regexplain File" \link{regexplain_addin}. | |||||
| \item \code{regexplain_web}: Launches the RegExplain gadget in a browser or an | \item \code{regexplain_web}: Launches the RegExplain gadget in a browser or an | ||||
| RStduio viewer pane. | RStduio viewer pane. | ||||
| }} | }} | ||||
| \examples{ | |||||
| \dontrun{ | |||||
| regexplain_gadget(text = month.name, pattern = "(Ma|Ju)|(er)") | |||||
| regexplain_web(text = month.name, pattern = "(Ma|Ju)|(er)") | |||||
| regexplain_file() | |||||
| } | |||||
| } |
| \title{Modified Text Input} | \title{Modified Text Input} | ||||
| \usage{ | \usage{ | ||||
| textInputCode(inputId, label, value = "", width = NULL, | textInputCode(inputId, label, value = "", width = NULL, | ||||
| placeholder = NULL) | |||||
| placeholder = NULL, ...) | |||||
| } | } | ||||
| \arguments{ | \arguments{ | ||||
| \item{inputId}{The \code{input} slot that will be used to access the value.} | \item{inputId}{The \code{input} slot that will be used to access the value.} | ||||
| \item{placeholder}{A character string giving the user a hint as to what can | \item{placeholder}{A character string giving the user a hint as to what can | ||||
| be entered into the control. Internet Explorer 8 and 9 do not support this | be entered into the control. Internet Explorer 8 and 9 do not support this | ||||
| option.} | option.} | ||||
| \item{...}{Extra elements to be included in the \code{input-group} div.} | |||||
| } | } | ||||
| \description{ | \description{ | ||||
| Standard \code{\link[shiny:textInput]{shiny::textInput()}} with additional \code{width} parameter, added code | Standard \code{\link[shiny:textInput]{shiny::textInput()}} with additional \code{width} parameter, added code |