This function generates a plot for group-specific proportions or distributions based on the provided registry data.

PlotAndelerGrVar(
  RegData,
  Variabel,
  grVar = "ShNavn",
  hovedgrTxt = "Total andel",
  kvalIndGrenser = NA,
  tittel = "tittel",
  utvalgTxt = "",
  Ngrense = 10,
  bestKvalInd = "lav",
  fargepalett = "BlaaOff",
  grtxt = "",
  titleSize = 20,
  subtitleSize = 15,
  legendSize = 12,
  axisTextSize = 12,
  nTicks = 5
)

Arguments

RegData

A data frame containing the registry data to be used for plotting.

Variabel

A numeric vector representing the variable of interest for which the proportions or distributions are to be calculated and plotted.

grVar

A character string specifying the grouping variable in the registry data (default is "ShNavn"). This variable will be used to group the data for plotting.

hovedgrTxt

A character string for the main group text to be displayed in the plot (default is "Total andel").

kvalIndGrenser

A numeric vector of length 4 specifying the quality indicator thresholds for coloring the background of the plot. The values should be in ascending order and represent the boundaries for different quality levels (e.g., low, medium, high).

tittel

A character string for the title of the plot .

utvalgTxt

A character vector containing text to be displayed as a subtitle or additional information in the plot (default is an empty string).

Ngrense

A numeric value specifying the minimum group size required for a group to be included in the plot (default is 10). Groups with fewer observations than this threshold will be marked differently in the plot.

bestKvalInd

A character string indicating the direction of the quality indicator coloring. Use "lav" for low values being better (green for low, red for high) and "høy" for high values being better (red for low, green for high). The default is "lav".

fargepalett

A character string specifying the color palette to be used for the plot. Options include "BlaaOff", "BlaaOffAlle", "StotteOff", and "offAlleFarger" (default is "BlaaOff"). Each palette corresponds to a predefined set of colors for the plot elements.

grtxt

A character string for additional group text to be displayed in the plot (default is an empty string).

titleSize

A numeric value specifying the font size for the plot title (default is 20).

subtitleSize

A numeric value specifying the font size for the plot subtitle (default is 15).

legendSize

A numeric value specifying the font size for the plot legend (default is 12).

axisTextSize

A numeric value specifying the font size for the axis text (default is 12).

nTicks

A numeric value specifying the number of ticks to be displayed on the y-axis (default is 5).

Value

A plot object visualizing the group-specific proportions or distributions.

Details

This function is designed to work with registry data and create visualizations that highlight group-specific metrics. The exact details of the plot depend on the structure of the input data and the specific implementation of the function.