Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfe0aac0

Browse files
committed
sensible defaults for maxDist
1 parent59c4b38 commitfe0aac0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎pkg/R/afind.R‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
153153
L<- afind(x,pattern,value=value,...)
154154
if (!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)
170170
L<- afind(x,pattern,value=FALSE,...)
171171
L$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)
184184
L<- afind(x,pattern,value=TRUE,...)
185185
out<-L$match

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp