Skip to contents

Usage

jjsegmentedtotalbar(
  data,
  analysis_preset = "custom",
  x_var,
  y_var,
  fill_var,
  facet_var = NULL,
  show_plot = FALSE,
  plot_type = "stacked",
  chart_style = "clinical",
  color_palette = "clinical",
  show_percentages = FALSE,
  percentage_format = "integer",
  show_counts = FALSE,
  label_threshold = 5,
  orientation = "vertical",
  sort_categories = "none",
  plot_title = "",
  x_title = "",
  y_title = "Percentage",
  legend_title = "",
  legend_position = "right",
  bar_width = 0.8,
  plot_width = 10,
  plot_height = 6,
  add_outline = FALSE,
  outline_color = "white",
  export_ready = FALSE,
  flerlage_show_labels = FALSE,
  flerlage_label_size = 4,
  flerlage_label_color = "black",
  flerlage_alpha = 0.3,
  flerlage_box_color = "lightgrey",
  show_statistical_tests = FALSE,
  confidence_level = 0.95,
  exclude_missing = TRUE,
  showExplanations = FALSE
)

Arguments

data

The data as a data frame.

analysis_preset

Predefined clinical analysis configurations.

x_var

Categorical variable for x-axis categories.

y_var

Numeric variable for segment values.

fill_var

Categorical variable for bar segment colors and composition.

facet_var

Optional variable for creating multiple panels.

show_plot

Show segmented total bar chart.

plot_type

Type of visualization - traditional 100\ Flerlage-style segmented total bars.

chart_style

Overall visual style for the chart.

color_palette

Color palette for segment fills.

show_percentages

Whether to display percentage labels on segments.

percentage_format

Format for percentage display.

show_counts

Whether to display raw count values on segments.

label_threshold

Minimum percentage for showing labels (0-50\

orientationOrientation of the bars.

sort_categoriesHow to sort the categories.

plot_titleMain title for the plot.

x_titleTitle for x-axis.

y_titleTitle for y-axis.

legend_titleTitle for the legend.

legend_positionPosition of the legend.

bar_widthWidth of the bars (0.1 to 1.0).

plot_widthWidth of the plot in inches.

plot_heightHeight of the plot in inches.

add_outlineWhether to add white outlines around segments.

outline_colorColor for segment outlines.

export_readyWhether to optimize plot for high-quality export.

flerlage_show_labelsShow value labels on Flerlage-style plots.

flerlage_label_sizeSize of value labels in Flerlage plots.

flerlage_label_colorColor of value labels in Flerlage plots.

flerlage_alphaTransparency of background boxes (0=transparent, 1=opaque).

flerlage_box_colorColor of background boxes in Flerlage plots.

show_statistical_testsWhether to perform chi-square tests for proportion differences.

confidence_levelConfidence level for statistical tests (0.80-0.99).

exclude_missingWhether to exclude rows with missing values in key variables.

showExplanationsShow explanations of the statistical results

A results object containing:

results$instructionsa html
results$plotan image
results$summarya table
results$composition_tablea table
results$detailed_statsa table
results$interpretationa html
results$clinical_summarya html
results$statistical_testsa table
results$preset_guidancea html
results$presetInfoa html
results$warningsa html
results$explanationsa html
Tables can be converted to data frames with asDF or as.data.frame. For example:results$summary$asDFas.data.frame(results$summary) Create segmented total bar charts (100\ proportional breakdowns within categories. Perfect for displaying composition data where each bar represents 100\