Skip to content

Commit e4b0bbb

Browse files
Add example of cols=<list> to ?setindexv (#6678)
* fixed#6665 * simplify --------- Co-authored-by: Michael Chirico <[email protected]>
1 parent 4a2474b commit e4b0bbb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

man/setkey.Rd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ setindex(DT, B)
142142
indices(DT) # get indices single vector
143143
indices(DT, vectors = TRUE) # get indices list
144144

145+
# Setting multiple indices at once
146+
DT = data.table(A = 5:1, B = letters[5:1], C = 10:6)
147+
setindexv(DT, list(c("A", "B"), c("B", "C")))
148+
print(DT, show.indices=TRUE)
149+
145150
# Use the dot .(subset_value) syntax with integer keys:
146151
DT = data.table(id = 2:1)
147152
setkey(DT, id)

0 commit comments

Comments
 (0)