Re: bash/awk equivalent code to gnu datamash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Sent from ProtonMail, encrypted email based in Switzerland.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Monday, May 25, 2020 3:01 AM, Samuel Sieb <samuel@xxxxxxxx> wrote:

> On 5/24/20 5:34 PM, None via users wrote:
>
> > Dear fellow fedora users,
> > If I have a data file called 15.dat with the following content:
> > $ cat 15.dat
> > 1
> > 3
> > 1
> > 0
> > 2
>
> I think you dropped the "6" from this copy.
>
> > And I want to find min, quartile 1, median, quartile 3 and maximum (Five number summary)
> > We can use datamash like
> > $ cat 15.dat | datamash min 1 q1 1 median 1 q3 1 max 1 0 1 1.5 2.75 6
> > Q3 is reported as 2.75 but if we split the data file in half the number is 3.
>
> I looked at the various ways of calculating quartiles and I can't find
> one that gives this result, but it is the same result as you can get
> from R (which datamash claims to be equivalent to):
> data <- c(0,1,1,2,3,6)
> summary(data)
>
> Min. 1st Qu. Median Mean 3rd Qu. Max.
> 0.000 1.000 1.500 2.167 2.750 6.000
>
> I can't tell you any more than that.
>
> users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
> Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx

I have heard of R but I am looking for awk/bash, bc or dc solution.  A website does give 3 as q3 instead of 2.75. Please see below


https://www.hackmath.net/en/calculator/five-number-summary

1 3 1 0 2 6


Minimum: 0
Quartile Q1: 1
Median: 1.5
Quartile Q3: 3
Maximum: 6

Calculation:

Statistical file:
{14, 0, 4, 0, 0, 1, 1, 7, 1, 0, 3, 1, 2, 0}

Minimum: 0
Quartile Q1: 0
Median: 1
Quartile Q3: 3
Maximum: 14

I would like to get the same since and correct solution since datamash and R do not output the same.

Best Regards


Antonio
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux