Bug#1057439: datamash: "antimode" returns lowest, instead of least common, value

2023-12-04 Thread Kingsley G. Morse Jr.
Package: datamash
Version: 1.8-1
Severity: normal

Dear Maintainer,

Thanks for maintaining datamash.

I like that it lets shell scripts calculate
statistics.

The main reason I'm writing is datamash's
"antimode" statistical grouping operation did not
work as I expected.

datamash's man page says its "antimode"
statistical grouping operation is for the "least
common value".

But, my testing suggests datamash's "antimode"
instead returns the lowest value.

My simple test is to 

1.) copy 

echo -e "1\n1\n2" | datamash antimode 1

to the bash command prompt and 

2.) press the  key.


At least on my computer, it returns "1".

But, I expected it to return "2", because "2" is
the least common value.

I suppose maybe either datamash's man page and/or code
could be changed so they're consistent.

Thanks again for datamash!

Kind regards,
Kingsley

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
merged-usr: no
Architecture: i386 (i686)

Kernel: Linux 6.5.0-1-686-pae (SMP w/2 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages datamash depends on:
ii  libc6  2.37-12

datamash recommends no packages.

datamash suggests no packages.

-- no debconf information

-- 
Time is the fire in which we all burn.



Bug#1057439: datamash: "antimode" returns lowest, instead of least common, value

2023-12-05 Thread Erik Auerswald
Hi Kingsley,

On Mon, Dec 04, 2023 at 09:05:57PM -0800, Kingsley G. Morse Jr. wrote:
> [...]
> The main reason I'm writing is datamash's
> "antimode" statistical grouping operation did not
> work as I expected.
> 
> datamash's man page says its "antimode"
> statistical grouping operation is for the "least
> common value".
> 
> But, my testing suggests datamash's "antimode"
> instead returns the lowest value.
> 
> My simple test is to 
> 
> 1.) copy 
> 
> echo -e "1\n1\n2" | datamash antimode 1
> 
> to the bash command prompt and 
> 
> 2.) press the  key.
> 
> At least on my computer, it returns "1".
> 
> But, I expected it to return "2", because "2" is
> the least common value.
> 
> I suppose maybe either datamash's man page and/or code
> could be changed so they're consistent.

For me, this also looks like a bug.  I think that the code is wrong and
the man page describes the intended behavior.

I hope that I'll have time to look into this in about two weeks.

Kind regards,
Erik