Skip to content

Commit 18ba9c5

Browse files
Use seq_along() where appropriate (#6824)
1 parent cbb918b commit 18ba9c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

R/data.table.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,7 @@ replace_dot_alias = function(e) {
11831183
} else {
11841184
# Adding new column(s). TO DO: move after the first eval in case the jsub has an error.
11851185
newnames=setdiff(lhs, names_x)
1186-
m[is.na(m)] = ncol(x)+seq_len(length(newnames))
1186+
m[is.na(m)] = ncol(x)+seq_along(newnames)
11871187
cols = as.integer(m)
11881188
# don't pass verbose to selfrefok here -- only activated when
11891189
# ok=-1 which will trigger setalloccol with verbose in the next
@@ -2380,7 +2380,7 @@ subset.data.table = function(x, subset, select, ...)
23802380
## Set the key on the returned data.table as long as the key
23812381
## columns that "remain" are the same as the original, or a
23822382
## prefix of it.
2383-
is.prefix = all(key(x)[seq_len(length(key.cols))] == key.cols)
2383+
is.prefix = all(key(x)[seq_along(key.cols)] == key.cols)
23842384
if (is.prefix) {
23852385
setattr(ans, "sorted", key.cols)
23862386
}
@@ -2867,7 +2867,7 @@ setDF = function(x, rownames=NULL) {
28672867
stopf("All elements in argument 'x' to 'setDF' must be of same length")
28682868
xn = names(x)
28692869
if (is.null(xn)) {
2870-
setattr(x, "names", paste0("V",seq_len(length(x))))
2870+
setattr(x, "names", paste0("V",seq_along(x)))
28712871
} else {
28722872
idx = !nzchar(xn) # NB: keepNA=FALSE intentional
28732873
if (any(idx)) {

0 commit comments

Comments
 (0)