plot_document_histogram_pie.Rd
This function takes a dataset and produces two visual representations of document types: a histogram and a pie chart. It displays the top 9 document types based on their frequency in the dataset.
plot_document_histogram_pie(x)
A data frame that must contain a column nct_id
for matching with a predefined documents
dataset, which is assumed to be in the user's environment.
A combined plot of a histogram and a pie chart. If the input data frame is missing, empty, or lacks document 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 documents
dataset on nct_id
and calculates the count of each document type.
If no document types are found, a warning is issued and a plot with a corresponding message is returned. Otherwise, the function creates two plots:
A histogram showing the count of the top 9 document types.
A pie chart showing the proportions of these top 9 document types.
Long document type names are wrapped for better display in the histogram. The final output is an arrangement of both the histogram and the pie chart in a single view.