formatCases: Format the disease case data set

Description Usage Arguments Details Value Author(s) Examples

Description

The formatCases funtion formats the case data set. Changes other formats of age and sex group to three columns: age, ageNumeric and sex.

Usage

1
formatCases(casedata, ageBreaks = NULL, years = NULL, aggregate.by = NULL)

Arguments

casedata

disease cases data set, usually a data.frame which contains age and sex and number of cases.

ageBreaks

results from getBreaks function.

years

if it contains multiple years, define which years will be included in.

aggregate.by

if want to view the data set from a macro way, could aggregate the data set by age or sex or other variables.

Details

After using formatCases function, the age columns will change to a "character" column contains ages in cut format, i.e [50,55), denotes age 50. The cut breaks can be found from the breaks of the population data set or defined by user. The original "age" column will changed to "ageNumeric" columns as factors. The sex column will have two levels "M" and "F" as factors. If "aggregate.by" is not NULL, the number of cases will be sum up by the groups defined in aggregate.by argument.

Value

formatCases function will return a data frame.

Author(s)

Patrick Brown

Examples

1
2
3
4
5
6
7
8
data('casedata')
data('popdata')
head(casedata)
caseformat <- formatCases(casedata, ageBreaks = getBreaks(names(popdata@data)))
head(caseformat)
caseformatagg <- formatCases(casedata, ageBreaks = getBreaks(names(popdata@data)), 
  aggregate.by=c("age", "sex"))
head(caseformatagg)

diseasemapping documentation built on Sept. 10, 2021, 9:06 a.m.