I would like to check if a data.table that my function is operating on is keyed. How does one do this? For example:
x = data.table(a=1:100, b=100:1)
setkey(x, a)
f = function(v) {v+1}
x[,f(b),by=a]
I would like to check inside f if there is a key set on x and what that key is
This would require access to the object that f was called from, in this case x. Is this possible in data.table?
But why would you need that?