| Library: | stats |
| See also: | discrete descriptive cumsum |
| Macro: | 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). | |
library("stats")
setenv("outputstringformat", "%s")
x=read("lizard")
xvars="height"|"diameter"|"shade"|"daytime"|"grahami"|"total"
frequency(x,xvars)
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,]
| Library: | stats |
| See also: | discrete descriptive cumsum |