miller
miller copied to clipboard
nest --explode -f: Support multiple fields [feature request]
It'd be useful to me for nest --explode to support multiple fields. For example
Actual output
❯❯❯ mlr nest --explode --values --across-records -f x,y <<<'x=a;b;c,y=1;2;3'
x=a;b;c,y=1;2;3
Desired output
❯❯❯ mlr nest --explode --values --across-records -f x,y <<<'x=a;b;c,y=1;2;3'
x=a,y=1
x=b,y=2
x=c,y=3
Thanks again for Miller, John!
hi @sjackman an off-topic note: a generic solution could be something similar to
mlr cat -n then \
label @ then \
reshape -r "[^@]" -o i,v then \
nest --explode --values --across-records -f v then \
step -a counter -f i -g i then \
cut -x -f @ then \
reshape -s i,v then \
cut -x -f i_counter<<<'x=a;b;c,y=1;2;3,z=baz;maz;caz'
I think this could be useful also for the --implode option, instead of using -f foo to implode fields foo_1,foo_2, one could use -f foo,bar and implode fields foo and bar.