Learn R Programming

AgeTopicModels (version 0.1.0)

plot_age_topics: Title plot the topic loadings across age.

Description

Title plot the topic loadings across age.

Usage

plot_age_topics(
  disease_names,
  trajs,
  plot_title = "",
  start_age = 30,
  top_ds = 10
)

Value

a ggplot object of the topic loading.

Arguments

disease_names

the list of disease names, ordered as the topic.

trajs

one disease topic, which should be a matrix of age-by-disease.

plot_title

the title of the figure.

start_age

starting age of the matrix, default 30.

top_ds

How many disease to show, default is 10. This will filter the disease by the average topic laodings across age and pick the top.

Examples

Run this code
disease_list <- UKB_349_disease %>%
dplyr::left_join(disease_info_phecode_icd10, by = c("diag_icd10"="phecode" )) %>%
dplyr::pull(phenotype)
topic_id <- 1 # plot the first topic
plot_age_topics(disease_names = disease_list,
        trajs = UKB_HES_10topics[30:80,,topic_id],
        plot_title = paste0("topic ", topic_id),
        top_ds = 7)

Run the code above in your browser using DataLab