getBarPlot: A convenient method to get bar plot from qualitative...

Description Usage Arguments Value Examples

Description

A convenient method to get bar plot from qualitative variable.

Usage

1
2
3
4
5
6
7
8
getBarPlot(
  data,
  variable,
  group = NULL,
  legend.position = "right",
  legend.width = 30,
  na.rm = TRUE
)

Arguments

data

a data.frame, containing the qualitative variable to describe with barplot

variable

a character vector, containing the name of the variables to describe

group

a character vector of length one, containing the name of the group which need to be used to describe the qualitative variable. Depault to NULL

legend.position

a characher vector of length one, containing the legend position. Must be in 'right', 'left', 'top', 'bottom, 'none'. Default to 'right'.

legend.width

a numeric vector of length one, containing the legend width. Default to 50

na.rm

a boolean vector of length one. If TRUE, missig value of variable will be remove. Default to TRUE

Value

a ggplot2 plot

Examples

1
2
3
4
data(mtcars)
mtcars$am <- as.factor(mtcars$am)
mtcars$vs <- as.factor(mtcars$vs)
getBarPlot(data = mtcars, variable = "vs", group = "am")

rgriffier/statsBordeaux documentation built on Aug. 11, 2021, 9:59 a.m.