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()?
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With