Skip to content

Commit

Permalink
Add example of cols=<list> to ?setindexv (#6678)
Browse files Browse the repository at this point in the history
* fixed#6665

* simplify

---------

Co-authored-by: Michael Chirico <[email protected]>
  • Loading branch information
venom1204 and MichaelChirico authored Dec 21, 2024
1 parent 4a2474b commit e4b0bbb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions man/setkey.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ setindex(DT, B)
indices(DT) # get indices single vector
indices(DT, vectors = TRUE) # get indices list

# Setting multiple indices at once
DT = data.table(A = 5:1, B = letters[5:1], C = 10:6)
setindexv(DT, list(c("A", "B"), c("B", "C")))
print(DT, show.indices=TRUE)

# Use the dot .(subset_value) syntax with integer keys:
DT = data.table(id = 2:1)
setkey(DT, id)
Expand Down

0 comments on commit e4b0bbb

Please sign in to comment.