1DBCOLPERCENTILE(1) User Contributed Perl Documentation DBCOLPERCENTILE(1)
2
3
4
6 dbcolpercentile - compute percentiles or ranks for an existing column
7
9 dbcolpercentile [-rplhS] column
10
12 Compute a percentile of a column of numbers. The new column will be
13 called percentile or rank. Non-numeric records are handled as in other
14 programs.
15
16 If the data is pre-sorted and only a rank is requested, no extra
17 storage is required. In all other cases, a full copy of data is
18 buffered on disk.
19
21 -p or --percentile
22 Show percentile (default).
23
24 -P or --rank or --nopercentile
25 Compute ranks instead of percentiles.
26
27 --fraction
28 Show fraction (percentage, except between 0 and 1, not cumulative
29 fraction).
30
31 -a or --include-non-numeric
32 Compute stats over all records (treat non-numeric records as zero
33 rather than just ignoring them).
34
35 -S or --pre-sorted
36 Assume data is already sorted. With one -S, we check and confirm
37 this precondition. When repeated, we skip the check.
38
39 -f FORMAT or --format FORMAT
40 Specify a printf(3)-style format for output statistics. Defaults
41 to "%.5g".
42
43 -T TmpDir
44 where to put tmp files. Also uses environment variable TMPDIR, if
45 -T is not specified. Default is /tmp.
46
47 Sort specification options (can be interspersed with column names):
48
49 -r or --descending
50 sort in reverse order (high to low)
51
52 -R or --ascending
53 sort in normal order (low to high)
54
55 -n or --numeric
56 sort numerically (default)
57
58 -N or --lexical
59 sort lexicographically
60
61 This module also supports the standard fsdb options:
62
63 -d Enable debugging output.
64
65 -i or --input InputSource
66 Read from InputSource, typically a file name, or "-" for standard
67 input, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue
68 objects.
69
70 -o or --output OutputDestination
71 Write to OutputDestination, typically a file name, or "-" for
72 standard output, or (if in Perl) a IO::Handle, Fsdb::IO or
73 Fsdb::BoundedQueue objects.
74
75 --autorun or --noautorun
76 By default, programs process automatically, but Fsdb::Filter
77 objects in Perl do not run until you invoke the run() method. The
78 "--(no)autorun" option controls that behavior within Perl.
79
80 --help
81 Show help.
82
83 --man
84 Show full manual.
85
87 Input:
88 #fsdb name id test1
89 a 1 80
90 b 2 70
91 c 3 65
92 d 4 90
93 e 5 70
94 f 6 90
95
96 Command:
97 cat DATA/grades.fsdb | dbcolpercentile test1
98
99 Output:
100 #fsdb name id test1 percentile
101 d 4 90 1
102 f 6 90 1
103 a 1 80 0.66667
104 b 2 70 0.5
105 e 5 70 0.5
106 c 3 65 0.16667
107 # | dbsort -n test1
108 # | dbcolpercentile test1
109
110 Command 2:
111 cat DATA/grades.fsdb | dbcolpercentile --rank test1
112
113 Output 2:
114 #fsdb name id test1 rank
115 d 4 90 1
116 f 6 90 1
117 a 1 80 3
118 b 2 70 4
119 e 5 70 4
120 c 3 65 6
121 # | dbsort -n test1
122 # | dbcolpercentile --rank test1
123
125 Fsdb. dbcolhisto.
126
128 Copyright (C) 1991-2018 by John Heidemann <johnh@isi.edu>
129
130 This program is distributed under terms of the GNU general public
131 license, version 2. See the file COPYING with the distribution for
132 details.
133
134
135
136perl v5.28.1 2019-02-02 DBCOLPERCENTILE(1)