diff --git a/c/todo.txt b/c/todo.txt index 53a4d58a1..610832f60 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -49,7 +49,8 @@ COOKBOOK CHECKLIST: ---------------------------------------------------------------- cook 1: -(done) +--> FIX MISS-DATE B04K! LOOK THRU REVHIST +--> FIX HAVING-LARGEST-VALUE B04K! ---------------------------------------------------------------- cook 2: fun stuff: diff --git a/doc/content-for-cookbook.html b/doc/content-for-cookbook.html index 4928da527..3a3a150c4 100644 --- a/doc/content-for-cookbook.html +++ b/doc/content-for-cookbook.html @@ -9,10 +9,6 @@ POKI_PUT_TOC_HERE -

Disclaimer: This page is about how to do some corner-case things in -ways you mightn’t have thought of. For an intro, please also see -Miller in 10 minutes. -

Headerless CSV on input or output

@@ -23,7 +19,7 @@ ways you mightn’t have thought of. For an intro, please also see POKI_RUN_COMMAND{{cat data/headerless.csv}}HERE -

You can use Miller to add a header: the --implicit-csv-header applies positionally indexed labels: +

You can use Miller to add a header. The --implicit-csv-header applies positionally indexed labels: POKI_RUN_COMMAND{{mlr --csv --implicit-csv-header cat data/headerless.csv}}HERE POKI_RUN_COMMAND{{mlr --icsv --implicit-csv-header --opprint cat data/headerless.csv}}HERE @@ -85,7 +81,7 @@ POKI_RUN_COMMAND{{mlr filter '$a == "wye"' then cat -n data/small}}HERE

The other is to keep your own counter within the put DSL: -POKI_RUN_COMMAND{{mlr filter '$a == "wye"' then put 'begin {@n = 1} $n = $n; @n += 1' data/small}}HERE +POKI_RUN_COMMAND{{mlr filter '$a == "wye"' then put 'begin {@n = 1} $n = @n; @n += 1' data/small}}HERE

The difference is a matter of taste (although mlr cat -n puts the counter first). @@ -132,8 +128,10 @@ POKI_RUN_COMMAND_TOLERATING_ERROR{{mlr --csvlite put '$reachable = asserting_str POKI_RUN_COMMAND{{head -n 10 data/miss-date.csv}}HERE POKI_RUN_COMMAND{{wc -l data/miss-date.csv}}HERE -

To find these, you can convert the dates to seconds since the epoch using strptime, then -compute adjacent differences (the cat -n simply inserts record-counters): +

Since there are 1372 lines in the data file, some automation is called for. +To find the missing dates, you can convert the dates to seconds since the epoch +using strptime, then compute adjacent differences (the cat -n +simply inserts record-counters): POKI_INCLUDE_AND_RUN_ESCAPED(data/miss-date-1.sh)HERE diff --git a/doc/cookbook.html b/doc/cookbook.html index 08652aefb..b6a368151 100644 --- a/doc/cookbook.html +++ b/doc/cookbook.html @@ -211,10 +211,6 @@ Miller commands were run with pretty-print-tabular output format. -

Disclaimer: This page is about how to do some corner-case things in -ways you mightn’t have thought of. For an intro, please also see -Miller in 10 minutes. -

Headerless CSV on input or output

@@ -235,7 +231,7 @@ Carol,45,present

-

You can use Miller to add a header: the --implicit-csv-header applies positionally indexed labels: +

You can use Miller to add a header. The --implicit-csv-header applies positionally indexed labels:

@@ -458,9 +454,9 @@ n=2,a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729

-$ mlr filter '$a == "wye"' then put 'begin {@n = 1} $n = $n; @n += 1' data/small
-a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
-a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
+$ mlr filter '$a == "wye"' then put 'begin {@n = 1} $n = @n; @n += 1' data/small
+a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,n=1
+a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,n=2
 

@@ -600,8 +596,10 @@ $ wc -l data/miss-date.csv

-

To find these, you can convert the dates to seconds since the epoch using strptime, then -compute adjacent differences (the cat -n simply inserts record-counters): +

Since there are 1372 lines in the data file, some automation is called for. +To find the missing dates, you can convert the dates to seconds since the epoch +using strptime, then compute adjacent differences (the cat -n +simply inserts record-counters):

@@ -1091,33 +1089,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put ' ' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds i o fcount seconds_delta 1 1 1 0 -2 2 3 0.000035048 -3 3 5 0.000013113 -4 5 9 0.000024796 -5 8 15 0.000020981 -6 13 25 0.000041008 -7 21 41 0.000055075 -8 34 67 0.000067949 -9 55 109 0.000109196 -10 89 177 0.000182867 -11 144 287 0.000307083 -12 233 465 0.000439882 -13 377 753 0.000730991 -14 610 1219 0.001173973 -15 987 1973 0.001893044 -16 1597 3193 0.003154993 -17 2584 5167 0.004925966 -18 4181 8361 0.007686138 -19 6765 13529 0.012122869 -20 10946 21891 0.019392014 -21 17711 35421 0.031095982 -22 28657 57313 0.050091982 -23 46368 92735 0.080941200 -24 75025 150049 0.130611897 -25 121393 242785 0.216569901 -26 196418 392835 0.340492010 -27 317811 635621 0.582877159 -28 514229 1028457 0.934934855 +2 2 3 0.000033140 +3 3 5 0.000012875 +4 5 9 0.000015020 +5 8 15 0.000020027 +6 13 25 0.000029087 +7 21 41 0.000043869 +8 34 67 0.000066042 +9 55 109 0.000106096 +10 89 177 0.000169039 +11 144 287 0.000271797 +12 233 465 0.000431061 +13 377 753 0.000690937 +14 610 1219 0.001108170 +15 987 1973 0.001784801 +16 1597 3193 0.002909184 +17 2584 5167 0.004741907 +18 4181 8361 0.007563114 +19 6765 13529 0.012151957 +20 10946 21891 0.019482851 +21 17711 35421 0.031655073 +22 28657 57313 0.055258989 +23 46368 92735 0.091561079 +24 75025 150049 0.143889904 +25 121393 242785 0.233440161 +26 196418 392835 0.386122942 +27 317811 635621 0.552792072 +28 514229 1028457 0.889795780

@@ -1149,33 +1147,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put ' ' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds i o fcount seconds_delta 1 1 1 0 -2 2 3 0.000036001 -3 3 3 0.000014067 -4 5 3 0.000011921 -5 8 3 0.000011921 +2 2 3 0.000035048 +3 3 3 0.000012875 +4 5 3 0.000010967 +5 8 3 0.000010967 6 13 3 0.000011206 7 21 3 0.000010967 -8 34 3 0.000010967 -9 55 3 0.000010967 +8 34 3 0.000010014 +9 55 3 0.000010014 10 89 3 0.000011921 -11 144 3 0.000012159 -12 233 3 0.000015020 +11 144 3 0.000010014 +12 233 3 0.000014067 13 377 3 0.000010967 -14 610 3 0.000011921 -15 987 3 0.000010967 +14 610 3 0.000010967 +15 987 3 0.000010014 16 1597 3 0.000010967 17 2584 3 0.000010014 -18 4181 3 0.000010967 -19 6765 3 0.000010967 -20 10946 3 0.000011206 +18 4181 3 0.000010014 +19 6765 3 0.000010014 +20 10946 3 0.000010014 21 17711 3 0.000010014 -22 28657 3 0.000010967 -23 46368 3 0.000012875 +22 28657 3 0.000010014 +23 46368 3 0.000011921 24 75025 3 0.000010967 -25 121393 3 0.000011206 -26 196418 3 0.000009775 -27 317811 3 0.000011206 -28 514229 3 0.000010967 +25 121393 3 0.000010014 +26 196418 3 0.000010014 +27 317811 3 0.000010014 +28 514229 3 0.000010014