Reputation: 7720
If you are using data.table you can set a key with the function setkey().
But how do you know what columns have already been set as key?
Any function such as getkey()?
Upvotes: 7
Views: 3443
Reputation: 886938
We can use key
to get the keys of the data.table
key(df1)
#[1] "col1" "col2"
df1 <- data.table(col1 = 1:5, col2 = 6:10, col3 = 11:15)
setkey(df1, col1, col2)
Upvotes: 9