barplot_ueb | R Documentation |
Barplot univariante o bivariante mostrando frecuencias relativas. En el caso del univariante es posible añadir las frecuencias absolutas. Para el análisis bivariante es posible realizar test Chi cuadrado.
barplot_ueb(
y,
group = NULL,
frml = NULL,
dat,
las = 0,
title.plot = NULL,
sub.plot = NULL,
cex.lab = 1,
cex.main = 1,
cex.lg = 1,
cex.n = 0.8,
ylab = "",
title.lg = FALSE,
do.test = FALSE,
show.lg = FALSE,
show.freq = TRUE,
max.levs = 10
)
y |
name factor vector of data values. |
group |
name factor vector. Default value is NULL. |
frml |
Right side of ~ must have the terms in an additive way, and left side of ~ must contain the name of the grouping variable or can be left in blank (in this latter case descriptives for whole sample are calculated and no test is performed). |
dat |
matrix or data frame containing the variables in the formula. |
las |
numeric in 0,1,2,3; the style of axis labels. 0: always parallel to the axis [default], 1: always horizontal, 2:always perpendicular to the axis, 3: always vertical. |
title.plot |
a main title for the plot |
sub.plot |
a sub title for the plot |
cex.lab |
expansion factor for axis names (bar labels). (size x labels) |
cex.main |
expansion factor for main names (size main) |
cex.lg |
expansion factor for legend names (size legend) |
cex.n |
expansion factor for size n |
ylab |
a title for the y axis |
do.test |
logical value si se quiere realizar test Chi cuadrado SIN corrección de yates. |
show.lg |
TRUE o FALSE indica si se muestra la leyenda. Por defecto FALSE. |
show.freq |
TRUE o FALSE indica si se muestran las frecuencias. Por defecto TRUE |
title.leg |
TRUE o FALSE indica si se muestra el titulo de la leyenda. Por defecto FALSE. |
Miriam Mota mmota.foix@gmail.com
df <- data.frame(sex = factor(c(sample(c('Male Male', 'Female Female'), 500, replace = TRUE, prob = c(.2,.8) ),
sample(c('Male Male', 'Female Female'), 500, replace = TRUE, prob = c(.4,.6) ))),
grup = factor(c( rep('Casos', 500),rep('Control', 500) )))
barplot_ueb(y = "grup", dat = df)
barplot_ueb(y = "sex",group = "grup", dat = df, cex.lab = 0.8, do.test = TRUE)
# El mateix cridant la funció amb formula
barplot_ueb(frml = ~ sex, dat = df)
barplot_ueb(frml = grup ~ sex, dat = df, cex.lab = 0.8, do.test = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.