plot_interventions_histogram.Rd
This function takes a dataset and produces two visual representations of interventions types: a histogram. It displays the top 10 interventions types based on their frequency in the dataset.
plot_interventions_histogram(x)
A data frame that must contain a column nct_id
for matching with a predefined interventions
dataset, which is assumed to be in the user's environment.
A histogram. If the input data frame is missing, empty, or lacks intervention types, the function returns a plot with a text annotation indicating the absence of data.
The function first checks if the input data frame is missing or empty and provides a warning message if so. It then joins the input data frame with the interventions
dataset on nct_id
and calculates the count of each intervention type.
If no intervention types are found, a warning is issued and a plot with a corresponding message is returned. Otherwise, the function creates a histogram showing the count of the top 10 intervention types.