quantile_cell {etable} | R Documentation |
Quantile cell function
Description
Calculating simple or weighted quantiles
Usage
quantile_cell(x, y, z, w, cell_ids, row_ids, col_ids, vnames, vars, n_min,
digits = 3, probs = 0.5, plabels=FALSE)
Arguments
x |
The x variable for calculations |
y |
NOT USED |
z |
NOT USED |
w |
Weights for x variable. |
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 significant digits. |
probs |
A single or a vector of numeric probabilities for sample quantile with values in [0,1]. |
plabels |
Logical asking whether to label the quantile in the cell or only draw the value. |
Author(s)
Andreas Schulz <ades-s@web.de>
Examples
sex <- factor(rbinom(1000, 1, 0.4), labels=c('Men', 'Women'))
height <- rnorm(1000, mean=1.66, sd=0.1)
height[which(sex=='Men')]<-height[which(sex=='Men')]+0.1
weight <- rnorm(1000, mean=70, sd=5)
decades <- rbinom(1000, 3, 0.5)
decades <- factor(decades, labels=c('[35,45)','[45,55)','[55,65)','[65,75)'))
d<-data.frame(sex, decades, height, weight)
tabular.ade(x_vars=c('height', 'weight'), xname=c('Height [m]','Weight [kg]'),
rows=c('sex', 'ALL'), rnames=c('Gender'),
cols=c('decades', 'ALL'), cnames=c('Age decades'),
data=d, FUN=quantile_cell, probs = 0.99)
[Package etable version 1.3.1 Index]