![](../logo.png)
Generate seropositivity plot from a raw serological survey dataset
Source:R/visualisation.R
plot_seroprev.Rd
Generate seropositivity plot from a raw serological survey dataset
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
andage_max
, the dataset could already include the age group markerage_mean_f
, representing the middle point betweenage_min
andage_max
. Ifafe_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 ofprepare_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 toTRUE
.
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]