no_amu: Define weeks with no AMU

Description Usage Arguments Value Examples

Description

The definition of a week without antimicrobial use (AMU) is based not only on the status of AMU during that week, but also potentially on the AMU during the n weeks that preceed.

Usage

1
no_amu(x, n = 0)

Arguments

x

A boolean vector describing the presence / absence of AMU. This vector has to be ordered chronologically (oldest first) and has to be with no gap.

n

An scalar integer specifying the number of weeks to consider before a focal week in order to define AMU.

Value

A boolean vector of the same length as x, with the first n values equal to NA.

Examples

1
2
3
4
5
no_amu(c(TRUE, rep(FALSE, 3)), 2)
amu <- rep(rep(c(TRUE, FALSE), 6), c(7, 2, 1, 2, 3, 1, 2, 1, 1, 1, 1, 3))
cbind(amu, no_amu(amu, 1))
# Note that each line is either c(FALSE, FALSE), c(TRUE, FALSE) or
# c(FALSE, TRUE), but there is no line that is c(TRUE, TRUE).

choisy/viparc documentation built on May 30, 2019, 11:38 p.m.