calculate_prevalence: Title of the function

Description Usage Arguments Value Examples

Description

This is what the function does bla bla bla.

Usage

1
2
calculate_prevalence(data, pops = NULL, conf.level = 0.95,
  region.head = "region", scale = 1)

Arguments

data

A line list-type data frame (one line per case), including a column with the region in which the case occurred

pops

A data frame containing one line per region in data, with first column for region name and second for population

conf.level

Level of confidence interval required for prevalence estimates.

region.head

A string containing the name of the column specifying the region for each case

scale

Scaling with which to report prevalence (per head, per 100 000, etc.)

Value

A data frame containing total population, number of cases and prevalence by region

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
my.data <- data.frame(county.id = ceiling(3*runif(10)),
                     age = rlnorm(10),
			sex = factor(floor(2*runif(10)), levels=c(0,1), labels=c("male", "female"))
                     )

my.populations <- data.frame(county.id = 1:3,
				population = c(10, 50, 100)
				)

# example without population of each region
calculate_prevalence(my.data, region.head="county.id")

# example with populations
calculate_prevalence(my.data, region.head="county.id", pops=my.populations)

Hackout2/mapData documentation built on May 6, 2019, 9:48 p.m.