Parcourir la source

Edits and updates to satisfy devtools::check()

main
Garrick Aden-Buie il y a 7 ans
Parent
révision
33625b6b15
3 fichiers modifiés avec 16 ajouts et 15 suppressions
  1. +1
    -0
      .Rbuildignore
  2. +6
    -6
      R/run_regex.R
  3. +9
    -9
      man/run_regex.Rd

+ 1
- 0
.Rbuildignore Voir le fichier

@@ -1,5 +1,6 @@
^.*\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^README\.Rmd$
^data-raw$
^docs$

+ 6
- 6
R/run_regex.R Voir le fichier

@@ -3,7 +3,7 @@
#' @param text Text to search
#' @param pattern regexp
#' @param global If `TRUE`, enables global pattern matching
#' @inheritDotParams base::regexec ignore.case perl fixed useBytes
#' @inheritParams base::regexec
run_regex <- function(
text,
pattern,
@@ -94,11 +94,11 @@ wrap_result <- function(x, escape = FALSE, exact = FALSE) {
collapse_span_inserts(inserts)
} else {
inserts %>%
tidyr::nest(-pass) %>%
mutate(data = purrr::map(data, collapse_span_inserts)) %>%
tidyr::nest(-.data$pass) %>%
mutate(data = purrr::map(.data$data, collapse_span_inserts)) %>%
tidyr::unnest() %>%
group_by(loc, type) %>%
summarize(insert = paste(insert, collapse = "")) %>%
group_by(.data$loc, .data$type) %>%
summarize(insert = paste(.data$insert, collapse = "")) %>%
dplyr::ungroup()
}

@@ -134,7 +134,7 @@ collapse_span_inserts <- function(inserts) {
inserts_other,
filter(inserts_g0, type == "end")
) %>%
mutate(type = sprintf("%05d%s", 1:nrow(.), type)) %>%
mutate(type = sprintf("%05d%s", dplyr::row_number(), type)) %>%
group_by(.data$loc, .data$type) %>%
summarize(insert = paste(.data$insert, collapse = '')) %>%
dplyr::ungroup() %>%

+ 9
- 9
man/run_regex.Rd Voir le fichier

@@ -12,19 +12,19 @@ run_regex(text, pattern, ignore.case = FALSE, perl = FALSE,

\item{pattern}{regexp}

\item{global}{If \code{TRUE}, enables global pattern matching}

\item{...}{Arguments passed on to \code{base::regexec}
\describe{
\item{ignore.case}{if \code{FALSE}, the pattern matching is \emph{case
\item{ignore.case}{if \code{FALSE}, the pattern matching is \emph{case
sensitive} and if \code{TRUE}, case is ignored during matching.}
\item{perl}{logical. Should Perl-compatible regexps be used?}
\item{fixed}{logical. If \code{TRUE}, \code{pattern} is a string to be

\item{perl}{logical. Should Perl-compatible regexps be used?}

\item{fixed}{logical. If \code{TRUE}, \code{pattern} is a string to be
matched as is. Overrides all conflicting arguments.}
\item{useBytes}{logical. If \code{TRUE} the matching is done

\item{useBytes}{logical. If \code{TRUE} the matching is done
byte-by-byte rather than character-by-character. See
\sQuote{Details}.}
}}

\item{global}{If \code{TRUE}, enables global pattern matching}
}
\description{
Extract matched groups from regexp

Chargement…
Annuler
Enregistrer