Learn R Programming

lares (version 5.0.1)

gg_bars: Quick Nice Bar Plot

Description

This function uses a nice template for barplots.

This function uses a nice template for barplots.

Usage

gg_bars(
  names,
  n,
  p = NA,
  title = NA,
  subtitle = NA,
  axis = "Counter",
  obs = TRUE,
  limit = 15,
  na.rm = FALSE
)

gg_bars( names, n, p = NA, title = NA, subtitle = NA, axis = "Counter", obs = TRUE, limit = 15, na.rm = FALSE )

Arguments

names

Character Vector. Bar names

n, p

Numeric Vectors. n for counter, p to force percentage.

title, subtitle, axis

Character. Texts for plot

obs

Boolean. Show observations counter?

limit

Integer. Limit n most frequent values only

na.rm

Boolean. Remove empty and NAs?

Value

ggplot2 object

ggplot2 object

See Also

Other Visualization: distr(), freqs_df(), freqs_list(), freqs_plot(), freqs(), gg_pie(), noPlot(), plot_chord(), plot_survey(), plot_timeline(), theme_lares(), tree_var()

Other Visualization: distr(), freqs_df(), freqs_list(), freqs_plot(), freqs(), gg_pie(), noPlot(), plot_chord(), plot_survey(), plot_timeline(), theme_lares(), tree_var()

Examples

Run this code
# NOT RUN {
Sys.unsetenv("LARES_FONT") # Temporal
data(dft) # Titanic dataset
df <- freqs(dft, Pclass)
gg_bars(df$Pclass, n = df$n)
gg_bars(df$Pclass, n = df$n, p = df$p, axis = "Percentage of ...")
Sys.unsetenv("LARES_FONT") # Temporal
data(dft) # Titanic dataset
df <- freqs(dft, Pclass)
gg_bars(df$Pclass, n = df$n)
gg_bars(df$Pclass, n = df$n, p = df$p, axis = "Percentage of ...")
# }

Run the code above in your browser using DataLab