plot_summary: Plot Summary

View source: R/plot.R

plot_summaryR Documentation

Plot Summary

Description

This function plots the summary of the clustering results.

Usage

plot_summary(object, ...)

## S3 method for class 'medic'
plot_summary(object, only = NULL, clusters = NULL, additional_data = NULL, ...)

## S3 method for class 'summary.medic'
plot_summary(
  object,
  n_breaks = 5,
  plot_individual = FALSE,
  labels = FALSE,
  alpha_individual = 0.1,
  label_y_value = 0.1,
  ...
)

Arguments

object

The object containing the summary data.

...

Additional arguments passed to the plotting functions.

only

<data-masking> Expressions that return a logical value, and are defined in terms of the variables in object and/or additional_data.

The default NULL selects all clusterings in object.

clusters

<tidy-select> An unquoted expression naming the cluster or clusters in object one wants to see summaries of. Names can be used as if they were positions in the data frame, so expressions like I:IV can be used to select a range of clusters.

The default NULL selects all clusters in the chosen clusterings of object.

additional_data

A data frame with additional data that may be (left-)joined onto the parameters in object. This is often used in conjuction with only to select specific clusterings based on additional_data.

n_breaks

The number of breaks for the time scale.

plot_individual

Logical value indicating whether to plot individual trajectories.

labels

Logical value indicating whether to include labels.

alpha_individual

The alpha value for the individual trajectories.

label_y_value

A number between 0 and 1 that defines the height of the label text hight.

Value

A ggplot object.

See Also

summary

plot_cluster_frequency

plot_medication_frequency

plot_comedication_count

plot_timing_trajectory

plot_timing_atc_group

Examples


clust <- medic(
  complications,
  id = id,
  atc = atc,
  k = 3,
  timing = first_trimester:third_trimester
)

clust |> plot_summary()
clust |> summary() |> plot_summary()

# If the clustering object contains more than one clustering, it is necessary
# to filter the clustering, as only one clustering can be plotted at a time.
clust <- medic(
  complications,
  id = id,
  atc = atc,
  k = 3:5,
  timing = first_trimester:third_trimester
)
clust |> plot_summary(only = k == 4)
clust |> summary(only = k == 4) |> plot_summary()


tame documentation built on April 12, 2025, 1:40 a.m.