Skip to content

Commit bcd2ec1

Browse files
author
kalibera
committed
Document that for loops implicitly unclass the seq argument (PR#18215).
git-svn-id: https://svn.r-project.org/R/trunk@88869 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 2549e90 commit bcd2ec1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/library/base/man/Control.Rd

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

66
\name{Control}
@@ -69,7 +69,11 @@ x \%||\% y
6969
variable \code{var} is assigned in turn the value of each element of
7070
\code{seq}. You can assign to \code{var} within the body of the loop,
7171
but this will not affect the next iteration. When the loop terminates,
72-
\code{var} remains as a variable containing its latest value.
72+
\code{var} remains as a variable containing its latest value. The
73+
\code{seq} is implicitly unclassed. For classed objects, one can use
74+
\code{\link{as.list}} to prepare a list to iterate over or
75+
\code{\link{seq_along}} to get an index vector and then explicitly extract
76+
individual elements (see also \code{\link{lapply}}).
7377

7478
The null coalescing operator \code{\%||\%} is a simple 1-line function:
7579
\code{x \%||\% y} is an idiomatic way to call

0 commit comments

Comments
 (0)