diff --git a/doc/content-for-cookbook.html b/doc/content-for-cookbook.html index a1ba164ea..94b07ae2d 100644 --- a/doc/content-for-cookbook.html +++ b/doc/content-for-cookbook.html @@ -146,6 +146,14 @@ POKI_RUN_COMMAND_TOLERATING_ERROR{{mlr --csv put '$reachable = asserting_string( POKI_INCLUDE_ESCAPED(data/nested.tsv)HERE +
The simplest option is to use mlr nest: + +POKI_RUN_COMMAND{{mlr --tsv nest --explode --values --across-records -f b --nested-fs : data/nested.tsv}}HERE +POKI_RUN_COMMAND{{mlr --tsv nest --explode --values --across-fields -f b --nested-fs : data/nested.tsv}}HERE + + While mlr nest is simplest, let’s also take a look at a few ways to do this using the +put DSL. + One option to split out the colon-delimited values in the b column is to use splitnv to create an integer-indexed map and loop over it, adding new fields to the current record: diff --git a/doc/cookbook.html b/doc/cookbook.html index 5868b5af4..5271cdb71 100644 --- a/doc/cookbook.html +++ b/doc/cookbook.html @@ -633,6 +633,36 @@ s u:v:w + The simplest option is to use mlr nest: + + ++$ mlr --tsv nest --explode --values --across-records -f b --nested-fs : data/nested.tsv +a b +x z +s u +s v +s w ++
+$ mlr --tsv nest --explode --values --across-fields -f b --nested-fs : data/nested.tsv +a b_1 +x z + +a b_1 b_2 b_3 +s u v w ++