Learn R Programming

serosv (version 1.1.0)

hbv_ru_1999: Hepatitis B serological data from Russia in 1999 (aggregated)

Description

A seroprevalence study conducted in St. Petersburg (more information in the book)

Usage

hbv_ru_1999

Arguments

Format

A data frame with 4 variables:

age

Age group

pos

Number of seropositive individuals

tot

Total number of individuals surveyed

gender

Gender of cohort (unsure what 1 and 2 means)

Examples

Run this code
# Reproduce Fig 4.2, p. 65
library(dplyr)
hbv_ru_1999$age <- trunc(hbv_ru_1999$age / 1) * 1
hbv_ru_1999$age[hbv_ru_1999$age > 40] <- trunc(
  hbv_ru_1999$age[hbv_ru_1999$age > 40] / 5
) * 5
df <- hbv_ru_1999 %>%
  group_by(age) %>%
  summarise(pos = sum(pos), tot = sum(tot))
plot(
  df$age, df$pos / df$tot,
  cex = 0.05 * df$tot, pch = 16, xlab = "age",
  ylab = "seroprevalence", xlim = c(0, 72)
)

Run the code above in your browser using DataLab