/* Procedure: freqtabl ** Author: Alan G. Isaac aisaac@american.edu ** Based on suggestions Scott Munroe posted to gaussians mailing list. ** Suggestions for improvement or extension are welcome. ** Date: 27 Sep 96 ** Provided without guarantees for free public, non-commercial use. ** ** Purpose: Produces a frequency table for elements in a GAUSS matrix ** Format: outmat = freqtabl(data,prt); ** Input: data matrix, the matrix for the frequency table. ** Output: outmat (k x 2)-matrix, the frequency table, where ** k is the number of unique elements in data, ** the first column lists the unique elements, ** the second column lists the associated frequencies */ proc (1) = freqtabl(data); local x,freq; if type(data) /= 6; print "Must provide data as a matrix.";stop;endif; if minc(rows(data)|cols(data)) /= 1;data=vecr(data);endif; x = unique(data,1); @unique elements of data, sorted@ freq = counts(data,x); @the absolute frequencies@ retp(x~freq); endp;