n_cell {etable} | R Documentation |
Frequency Cell FUN
Description
For calculation of relative or absolute frequencies.
Usage
n_cell(x, y, z, w, cell_ids, row_ids, col_ids, vnames, vars, n_min,
digits=0, digits2=1, type="n")
Arguments
x |
The x variable (can be just 1:N if without missings values) |
y |
NOT USED |
z |
NOT USED |
w |
Weights for x variable. Only if calculating weigted frequences. |
cell_ids |
Index vector for selecting values in cell. |
row_ids |
Index vector for selecting values in row. |
col_ids |
Index vector for selecting values in col. |
vnames |
NOT USED |
vars |
NOT USED |
n_min |
NOT USED |
digits |
Integer indicating the number of decimal places (N) |
digits2 |
Integer indicating the number of decimal places (percentages) |
type |
Type of frequencies, one of following.
|
Details
The function calculate frequencies for cell. If x has no missing values the frequencies are independent of x. Missing values in x will be removed from calculation.
Author(s)
Andreas schulz <ades-s@web.de>
Examples
sex <- factor(rbinom(1000, 1, 0.4), labels=c('Men', 'Women'))
decades <- rbinom(1000, 3, 0.5)
decades <- factor(decades, labels=c('[35,45)','[45,55)','[55,65)','[65,75)'))
d<-data.frame(sex, decades)
tabular.ade(x_var='sex', rows=c('sex', 'ALL'), rnames=c('Gender'),
cols=c('decades', 'ALL'), cnames=c('Age decades'),
data=d, FUN=n_cell, , type="all")