@@ -148,7 +148,7 @@ afind <- function(x, pattern, window=NULL
148148# ' \code{x} a match was found with a distance \code{<= maxDist}. The matched
149149# ' values when \code{value=TRUE} (equivalent to \code{\link[base]{grep}}).
150150# ' @export
151- grab <- function (x ,pattern ,maxDist ,value = FALSE ,... ){
151+ grab <- function (x ,pattern ,maxDist = Inf ,value = FALSE ,... ){
152152 stopifnot(is.numeric(maxDist ),maxDist > = 0 , length(pattern )== 1 )
153153L <- afind(x ,pattern ,value = value ,... )
154154if (! value ){
@@ -165,7 +165,7 @@ grab <- function(x, pattern, maxDist, value=FALSE, ...){
165165# ' \code{x} a match was found with a distance \code{<= maxDist}. (equivalent
166166# ' to \code{\link[base:grep]{grepl}}).
167167# ' @export
168- grabl <- function (x ,pattern ,maxDist ,... ){
168+ grabl <- function (x ,pattern ,maxDist = Inf ,... ){
169169 stopifnot(is.numeric(maxDist ),maxDist > = 0 , length(pattern )== 1 )
170170L <- afind(x ,pattern ,value = FALSE ,... )
171171L $ distance < = maxDist
@@ -179,7 +179,7 @@ grabl <- function(x, pattern, maxDist, ...){
179179# ' \code{NA} where no match was found and the first matched string if there is
180180# ' a match. (similar to \code{stringr::str_extract}).
181181# ' @export
182- extract <- function (x ,pattern ,maxDist ,... ){
182+ extract <- function (x ,pattern ,maxDist = Inf ,... ){
183183 stopifnot(is.numeric(maxDist ),maxDist > = 0 , length(pattern )== 1 )
184184L <- afind(x ,pattern ,value = TRUE ,... )
185185out <- L $ match