plot_bar: Bar plot for univariate analysis

Description Usage Arguments Details Value Author(s) Examples

Description

It counts a categorical variable and plots a publication ready ggplot2 barplot

Usage

1
2
3
4
plot_bar(df, x, title = NULL, subtitle = NULL, theme = "light",
  mode = "count", fill = FALSE, flip = FALSE, fillc = "darkgrey",
  base_font = "Fira Sans Condensed",
  title_font = "Fira Sans Condensed Medium")

Arguments

df

a data frame

x

a string indicating a categorical variable

title

a string defining the plot title

subtitle

a string defining de subtitle of plot

theme

a string defining theme: "light" (default) or "dark"

mode

a string defining mode: "count" (default) or "prop"

fill

a string indicating a categorical variable

flip

a logical TRUE or FALSE

fillc

bar colors when fill == FALSE

base_font

a string indicating which font to use (default is Fira Sans Condensed)

title_font

a string indicating which font to use (default is Fira Sans Condensed Medium)

Details

Uses dplyr and ggplot

Value

Um grafico de barras para a variavel x da base df.

Author(s)

Bruno Pinheiro

Examples

1
2
3
4
5
6
# simple barplot
plot_bar(sample_data, "var5")

# plot more than one variable at once
vars <- c("var5", "year")
plots <- lapply(vars, function(i) plot_bar(sample_data, i))

bruno-pinheiro/seda documentation built on May 23, 2019, 1:59 a.m.