descPlot: A desc_plot Function

View source: R/desc_plot.R

descPlotR Documentation

A desc_plot Function

Description

Genera graficos univariantes para todas las variables que se indiquen, el formato de entrada es 'data.frame'

Usage

descPlot(...)

Arguments

dat

data frame que contiene las variables a graficar.

covariates

a character string with names of variables.

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).

topdf

valor lógico indicando si se quieren guardar los gráficos en pdf. Por defecto FALSE.

nameFile

nombre del fichero (tipo caracter) donde guardar los gráficos. Por defecto 'descriptive_plots.pdf'.

subtitle

subtitol

color

nombre del color para pintar el gráfico

rowcol

c(nrows, ncols) to create a matrix of nrows x ncols plots that are filled in by row

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

cex.lab

expansion factor for axis names (bar labels). (size x labels)

cex.lg

character expansion factor relative to current par('cex'). Used for text, and provides the default for pt.cex and title.cex.

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.

do.test

logical value si se quiere realizar test kruskall Wallis.

bw

logical value for beeswarm

Author(s)

Miriam Mota mmota.foix@gmail.com

Examples

df <- data.frame(Y=as.factor(rbinom(50,1,.40)),Y1=as.factor(rbinom(50,1,.40)),X = rnorm(50,10,1))
desc_plot(dat = df, color = 'red', rowcol = c(1,2))
desc_plot(dat = df, y = 'Y', color = 'red', rowcol = c(1,1), las = 2)
desc_plot(mtc_bis)
desc_plot(dat = mtc_bis, y ='am', rowcol = c(2,2), do.test = FALSE, las = 2 )

## Indicant variables a evaluar
desc_plot(covariates = c("cyl","wt"),dat = mtc_bis, rowcol = c(2,2), do.test = FALSE, las = 2 )
desc_plot(covariates = c("cyl","wt"),dat = mtc_bis, y ='am', rowcol = c(2,2), do.test = FALSE, las = 2 )
desc_plot(covariates = c("cyl","wt"),dat = mtc_bis, y ='am', rowcol = c(2,2), do.test = FALSE, las = 2,bw = FALSE )

# Indicanta variables a evaluar mitjançant formula
desc_plot(frml =  ~ cyl + wt ,dat = mtc_bis, rowcol = c(2,2), do.test = FALSE, las = 2 )
desc_plot(frml = am ~ cyl + wt ,dat = mtc_bis, rowcol = c(2,2), do.test = FALSE, las = 2 )

miriamMota/mmotaF documentation built on Jan. 12, 2023, 4 a.m.