Просмотр исходного кода

Edits and updates to satisfy devtools::check()

main
Garrick Aden-Buie 7 лет назад
Родитель
Сommit
33625b6b15
3 измененных файлов: 16 добавлений и 15 удалений
  1. +1
    -0
      .Rbuildignore
  2. +6
    -6
      R/run_regex.R
  3. +9
    -9
      man/run_regex.Rd

+ 1
- 0
.Rbuildignore Просмотреть файл

^.*\.Rproj$ ^.*\.Rproj$
^\.Rproj\.user$ ^\.Rproj\.user$
^LICENSE\.md$ ^LICENSE\.md$
^README\.Rmd$
^data-raw$ ^data-raw$
^docs$ ^docs$

+ 6
- 6
R/run_regex.R Просмотреть файл

#' @param text Text to search #' @param text Text to search
#' @param pattern regexp #' @param pattern regexp
#' @param global If `TRUE`, enables global pattern matching #' @param global If `TRUE`, enables global pattern matching
#' @inheritDotParams base::regexec ignore.case perl fixed useBytes
#' @inheritParams base::regexec
run_regex <- function( run_regex <- function(
text, text,
pattern, pattern,
collapse_span_inserts(inserts) collapse_span_inserts(inserts)
} else { } else {
inserts %>% 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() %>% 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() dplyr::ungroup()
} }


inserts_other, inserts_other,
filter(inserts_g0, type == "end") 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) %>% group_by(.data$loc, .data$type) %>%
summarize(insert = paste(.data$insert, collapse = '')) %>% summarize(insert = paste(.data$insert, collapse = '')) %>%
dplyr::ungroup() %>% dplyr::ungroup() %>%

+ 9
- 9
man/run_regex.Rd Просмотреть файл



\item{pattern}{regexp} \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.} 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.} 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 byte-by-byte rather than character-by-character. See
\sQuote{Details}.} \sQuote{Details}.}
}}

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

Загрузка…
Отмена
Сохранить