Skip to contents

Generate seropositivity plot from a raw serological survey dataset

Usage

plot_seroprev(serodata, size_text = 6, bin_data = TRUE, bin_step = 5)

Arguments

serodata

A data frame containing the data from a serological survey. This data frame must contain the following columns:

survey

survey Label of the current survey

total

Number of samples for each age group

counts

Number of positive samples for each age group

age_min

age_min

age_max

age_max

tsur

Year in which the survey took place

country

The country where the survey took place

test

The type of test taken

antibody

antibody

Alternatively to age_min and age_max, the dataset could already include the age group marker age_mean_f, representing the middle point between age_min and age_max. If afe_mean_f is missing, it will be generated by the function.

size_text

Text size use in the theme of the graph returned by the function.

bin_data

If TRUE, serodata is binned by means of prepare_bin_data. Otherwise, age groups are kept as originally input.

bin_step

Integer specifying the age groups bin size to be used when bin_data is set to TRUE.

Value

A ggplot object containing the seropositivity-vs-age graph of the raw data of a given seroprevalence survey with its corresponding binomial confidence interval.

Examples

data(chagas2012)
serodata <- prepare_serodata(chagas2012)
plot_seroprev(serodata, size_text = 15)
#> Warning: (age_min - age_max) is not an integer multiple of step.
#>     The last age interval will be truncated to (75,77]