Description Usage Arguments Author(s) Examples
View source: R/eventpct_cell.R
Calculates frequencies or proportions of a certain level of factor x.
1 2 | eventpct_cell(x, y, z, w, cell_ids, row_ids, col_ids, vnames, vars, n_min,
digits=1, digits2=0, event=2, type=1)
|
x |
The factor x for calculations |
y |
NOT USED |
z |
NOT USED |
w |
Weights for x factor, only if calculating weighted frequencies. |
cell_ids |
Index vector for selecting values in cell. |
row_ids |
NOT USED |
col_ids |
NOT USED |
vnames |
NOT USED |
vars |
NOT USED |
n_min |
Minimum n in the cell for useful calculation. Cells with n<n_min deliver no output. |
digits |
Integer indicating the number of decimal places (for percentages) |
digits2 |
Integer indicating the number of decimal places (N, needed if N is not integer because of weighting) |
event |
The Number of factor level to calculate frequencies. from 1 to nlevels(x) |
type |
Type of representation, one of following.
|
Andreas Schulz <ades-s@web.de>
1 2 3 4 5 6 7 8 9 10 | sex <- factor(rbinom(1000, 1, 0.4), labels=c('Men', 'Women'))
event <- factor(rbinom(1000, 1, 0.1), labels=c('no', 'yes'))
decades <- rbinom(1000, 3, 0.5)
decades <- factor(decades, labels=c('[35,45)','[45,55)','[55,65)','[65,75)'))
d<-data.frame(sex, decades, event)
tabular.ade(x_vars=c('event'), xname=c('Event'),
rows=c('sex','ALL'), rnames=c('Gender'),
cols=c('decades', 'ALL'), cnames=c('Age decades'),
data=d, FUN=eventpct_cell)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.