Learn R Programming

imprinting (version 0.1.1)

plot_many_country_years: Plot imprinting probabilities for up to five country-years

Description

For each country and year, generate two plots:

  • A stacked barplot, where each bar represents a birth cohort, and the colors within the bar show the probabilities that someone born in that cohort has a particular imprinting status, for the first observation year.

  • A lineplot showing the age-specific probability of imprinting to H3N2 in the first and last observation year. When the data contain more than one observation year, this plot shows how cohorts age over time.

Usage

plot_many_country_years(imprinting_df)

Value

No return value. Opens a plot of the data frame.

Arguments

imprinting_df

A long data frame of imprinted probabilities output by get_imprinting_probabilities(). Up to five countries and an arbitrary span of years can be plotted.

Examples

Run this code
imprinting_df <- get_imprinting_probabilities(
  observation_years = c(1920, 1921),
  countries = c("Oman", "Indonesia")
)
plot_many_country_years(imprinting_df)

Run the code above in your browser using DataLab