Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: stats
See also: discrete descriptive cumsum

Quantlet: frequency
Description: provides frequency tables for all columns of a matrix. An additional vector of name strings can be given to identify columns by names.

Usage: freq=frequency(x{,xvars{,outwidth})
Input:
x n x p matrix, the columns correspond to the variables. The matrix may be numeric or string.
xvars optional, p x 1 string vector, variable names.
outwidth optional, integer<71, outwidth for categories, default=15.
Output:
freq string output, containing frequency table(s).

Example:
library("stats")
setenv("outputstringformat", "%s")
x=read("lizard")
xvars="height"|"diameter"|"shade"|"daytime"|"grahami"|"total"
frequency(x,xvars)

Result:
frequency tables for all six variables, as e.g. for height:
[  1,]
[  2,] ==================================================
[  3,]  Variable height
[  4,] ==================================================
[  5,]                 |  Frequency  Percent  Cumulative
[  6,] --------------------------------------------------
[  7,]               0 |         12    0.500      0.500
[  8,]               1 |         12    0.500      1.000
[  9,] --------------------------------------------------
[ 10,]                 |         24    1.000
[ 11,] ==================================================
[ 12,]



Author: M. Mueller, 19970702
(C) MD*TECH Method and Data Technologies, 05.02.2006