mode_cell {etable} | R Documentation |
Mode cell function
Description
Shows the most frequent value (mode)
Usage
mode_cell(x, y, z, w, cell_ids, row_ids, col_ids, vnames, vars, n_min,
digits=3)
Arguments
x |
The x variable |
y |
NOT USED |
z |
NOT USED |
w |
Weights for x variable. Only if calculating weighted mode. |
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 significant digits. |
Author(s)
Andreas Schulz <ades-s@web.de>
Examples
sex <- factor(rbinom(1000, 1, 0.4), labels=c('Men', 'Women'))
note <- as.factor(rbinom(1000, 4, 0.5)+1)
decades <- rbinom(1000, 3, 0.5)
decades <- factor(decades, labels=c('[35,45)','[45,55)','[55,65)','[65,75)'))
d<-data.frame(sex, decades, note)
tabular.ade(x_vars=c('note'), xname=c('Noten'),
rows=c('sex','ALL','decades'), rnames=c('Gender', 'Age decades'),
data=d, FUN=mode_cell)
[Package etable version 1.3.1 Index]