AxisKeys.jl
AxisKeys.jl copied to clipboard
Add `rekey` method
It's kind of annoying needing to reconstruct a KeyedArray every time you want to replace the keys in an array. I was thinking that we could do something similar to rename:
rekey(ka, (key1, key2, ...))
rekey(ka, dim1 => key1)
Maybe also:
rekey(ka, dim1 => (newdim, key1))
To do a rename and rekey in one operation?
NOTE: We're already doing a version of this in AxisSets.jl, but it'd be nice if we could just extend a method here.
Sounds good. Unlike rename, there's no confusion which way the arrow goes, so rekey(ka; dim1=kv1) would also be OK.