Skip to content

Commit 9209836

Browse files
author
ripley
committed
add warning on use of unnamed args
git-svn-id: https://svn.r-project.org/R/trunk@87828 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 3886231 commit 9209836

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

src/library/base/man/grep.Rd

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% File src/library/base/man/grep.Rd
22
% Part of the R package, https://www.R-project.org
3-
% Copyright 1995-2022 R Core Team
3+
% Copyright 1995-2025 R Core Team
44
% Distributed under GPL 2 or later
55

66
\name{grep}
@@ -286,6 +286,13 @@ gregexec(pattern, text, ignore.case = FALSE, perl = FALSE,
286286
in 8-bit encodings can differ considerably between platforms, modes
287287
and from the UTF-8 versions.
288288
}
289+
\section{Warning}{
290+
An all too cmmmon mis-usage is to pass unnamed arguments which are then
291+
matched to one or more of \code{ignore.case}, \code{perl}, \code{value},
292+
\code{fixed}, \code{useBytes} and \code{invert}. So it is good
293+
practice to name all the arguments (especially as
294+
\code{x}/\code{text} is not the first argument).
295+
}
289296

290297
\references{
291298
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)

src/library/base/man/grepRaw.Rd

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% File src/library/base/man/grepRaw.Rd
22
% Part of the R package, https://www.R-project.org
3-
% Copyright 1995-2016 R Core Team
3+
% Copyright 1995-2025 R Core Team
44
% Distributed under GPL 2 or later
55

66
\name{grepRaw}
@@ -73,6 +73,14 @@ grepRaw(pattern, x, offset = 1L, ignore.case = FALSE,
7373
is used except for \code{fixed = TRUE}.
7474
}
7575

76+
\section{Warning}{
77+
An all too cmmmon mis-usage is to pass unnamed arguments which are then
78+
matched to one or more of \code{ignore.case}, \code{value},
79+
\code{fixed}, \code{all} or \code{invert}. So it is good practice to
80+
name all the arguments.
81+
}
82+
83+
7684
% the `aka' below is for ESS
7785
\seealso{
7886
\link{regular expression} (aka \code{\link{regexp}}) for the details

src/library/base/man/strsplit.Rd

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% File src/library/base/man/strsplit.Rd
22
% Part of the R package, https://www.R-project.org
3-
% Copyright 1995-2024 R Core Team
3+
% Copyright 1995-2024=5 R Core Team
44
% Distributed under GPL 2 or later
55

66
\name{strsplit}
@@ -104,6 +104,13 @@ strsplit(x, split, fixed = FALSE, perl = FALSE, useBytes = FALSE)
104104
substituted invalid bytes.
105105
}
106106

107+
\section{Warning}{
108+
An all too cmmmon mis-usage is to pass unnamed arguments which are then
109+
matched to one or more of \code{fixed},
110+
\code{perl} and \code{useBytes}. So it is good
111+
practice to name all the arguments.
112+
}
113+
107114
\seealso{
108115
\code{\link{paste}} for the reverse,
109116
\code{\link{grep}} and \code{\link{sub}} for string search and

0 commit comments

Comments
 (0)