@@ -148,7 +148,7 @@ afind <- function(x, pattern, window=NULL
148
148
# ' \code{x} a match was found with a distance \code{<= maxDist}. The matched
149
149
# ' values when \code{value=TRUE} (equivalent to \code{\link[base]{grep}}).
150
150
# ' @export
151
- grab <- function (x , pattern , maxDist , value = FALSE , ... ){
151
+ grab <- function (x , pattern , maxDist = Inf , value = FALSE , ... ){
152
152
stopifnot(is.numeric(maxDist ), maxDist > = 0 , length(pattern ) == 1 )
153
153
L <- afind(x , pattern , value = value , ... )
154
154
if (! value ){
@@ -165,7 +165,7 @@ grab <- function(x, pattern, maxDist, value=FALSE, ...){
165
165
# ' \code{x} a match was found with a distance \code{<= maxDist}. (equivalent
166
166
# ' to \code{\link[base:grep]{grepl}}).
167
167
# ' @export
168
- grabl <- function (x , pattern , maxDist , ... ){
168
+ grabl <- function (x , pattern , maxDist = Inf , ... ){
169
169
stopifnot(is.numeric(maxDist ), maxDist > = 0 , length(pattern ) == 1 )
170
170
L <- afind(x , pattern , value = FALSE , ... )
171
171
L $ distance < = maxDist
@@ -179,7 +179,7 @@ grabl <- function(x, pattern, maxDist, ...){
179
179
# ' \code{NA} where no match was found and the first matched string if there is
180
180
# ' a match. (similar to \code{stringr::str_extract}).
181
181
# ' @export
182
- extract <- function (x , pattern , maxDist , ... ){
182
+ extract <- function (x , pattern , maxDist = Inf , ... ){
183
183
stopifnot(is.numeric(maxDist ), maxDist > = 0 , length(pattern ) == 1 )
184
184
L <- afind(x , pattern , value = TRUE , ... )
185
185
out <- L $ match
0 commit comments